Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aYuo1-00038Q-0z for pgadmin-hackers@arkaria.postgresql.org; Thu, 25 Feb 2016 12:14:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aYuo0-0001y8-KB for pgadmin-hackers@arkaria.postgresql.org; Thu, 25 Feb 2016 12:14:04 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aYunl-0001iq-Oj for pgadmin-hackers@postgresql.org; Thu, 25 Feb 2016 12:13:50 +0000 Received: from mail-io0-x230.google.com ([2607:f8b0:4001:c06::230]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aYuni-0005Pj-MF for pgadmin-hackers@postgresql.org; Thu, 25 Feb 2016 12:13:48 +0000 Received: by mail-io0-x230.google.com with SMTP id l127so85642088iof.3 for ; Thu, 25 Feb 2016 04:13:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=M9mE9qJ8dR0Yr/Pzn0IU6NwaUToa/dTSMpBmi8F4wYQ=; b=byIylPPl1jS6zmIdtGFC3gFLboGIbxXEDY/EhAfWUPwFvm/pr8TCQOrxk+0QsldzI8 cjhm57qA5HwxnBHwBh8ICzr4cB4cVjaat+mpH8bo+q2zLeJLCq7XrbthLRPP76661awh CLJdlPdDMR59soBbMcwfUdaN1M4ENa58EcHgQxO54oH0jmRsj4+6fh+1dw4nEj7NearE JxqEMbXBfaGhuXMFYxTg3Es9DG4CqYC8dZgkBAEZXB9a+8odjZefBFkT/UMICDEi/2cn 27cMLjeOpxl/5ZYbWBkC109g0j0UxmEP1RfbsqSKO27reJKnc0VaKVv4Cl5RpRBSVajo TLag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=M9mE9qJ8dR0Yr/Pzn0IU6NwaUToa/dTSMpBmi8F4wYQ=; b=nN3CbPiDGiGkyFHwKPL4OHTVez1ohHauI/MIpmTGRch7kO6FMoPmIECGEAShph53gh 4PH+tkYqhNf+w2iMHXrB/uIqdzBJJgPD9ax2OQJLU1Wd+/RtC2F3YATd0HAQNuRBR0EY X/IzkECiSD1xm0yZtfem0bwTLPSbriG1WAmtauZQc+5bZ1qZIOMeVmYJFyII67HsfCX9 x8cgImeveyB2W4adUYM4Xj3j4uOik4eI7KCNIKlDEtKsn1uFv3bqWleHkplC7nxS8lZ7 zKbxE0bRQrJm8nJLROF/wrMBlR+05/LOCmVgtP7C8YQmsjFiT/b0soYE61kvw52N2a2C 18rw== X-Gm-Message-State: AG10YORc4JaFWDO5DDz3uiFvodM2oDNUuN0lH6DHwUxioV+1tZGxs/Ugd99gFSTnfTZzvsUbvCz2L6w6Q5IA/w== MIME-Version: 1.0 X-Received: by 10.107.6.205 with SMTP id f74mr2720675ioi.63.1456402425053; Thu, 25 Feb 2016 04:13:45 -0800 (PST) Received: by 10.64.90.3 with HTTP; Thu, 25 Feb 2016 04:13:44 -0800 (PST) In-Reply-To: References: Date: Thu, 25 Feb 2016 12:13:44 +0000 Message-ID: Subject: Re: pgAdmin4 PATCH: Domain Module From: Dave Page To: Khushboo Vashi Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary=001a113f922e321cfb052c971daf X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgadmin-hackers Precedence: bulk Sender: pgadmin-hackers-owner@postgresql.org --001a113f922e321cfb052c971daf Content-Type: text/plain; charset=UTF-8 Hi On Wed, Feb 24, 2016 at 9:24 AM, Khushboo Vashi < khushboo.vashi@enterprisedb.com> wrote: > Hi, > > I have updated the Domain module as below: > > - Used 'NodeByListControl' to get schemas, in domains.js file as suggested > by Ashesh to avoid code redundancy. > > - Applied *'Security Label Macro'* Patch (Implemented by Harshal) and > removed same changes from the Domain Patch. > To test Domain patch, 'Security Label Macro' patch must be applied first > as that is not committed yet. > > Please find attached Domain Module Patch. > Initial feedback: - Owner and schema should be allowed to be left blank (and then default to the current user/schema) - Length and Precision fields should only be enabled if appropriate for the data type. - SQL generation for new Domains doesn't work: - When adding constraints, I should be able to type directly into the grid. Expanding the row should be optional. - The comment column on the constraints grid expands when the text reaches ~50% of the width. It should be a fixed size (and use 100% of the space available, less appropriate margins). - Backend support checks should not special-case Slony schemas. - 4 character indentation not used consistently in SQL templates. - Error seen when saving a domain: "macros/schemas/security.macros" 016-02-25 11:55:10,728: INFO werkzeug: 127.0.0.1 - - [25/Feb/2016 11:55:10] "GET /browser/domain/msql/1/1/24587/2200/?name=email&owner=postgres&basensp=public&description=This+is+an+email+data+type&basetype=text&typlen=&precision=&typdefault=&typnotnull=true&collname=&constraints=%5B%5D&seclabels=%5B%5D&_=1456401124386 HTTP/1.1" 500 - Traceback (most recent call last): File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__ return self.wsgi_app(environ, start_response) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py", line 84, in view return self.dispatch_request(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line 248, in dispatch_request return method(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py", line 277, in wrap return f(*args, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py", line 232, in wrap return f(self, **kwargs) File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py", line 700, in msql status=200 File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/ajax.py", line 41, in make_json_response response=json.dumps(doc, cls=DataTypeJSONEncoder), File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/__init__.py", line 386, in dumps **kw).encode(obj) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/encoder.py", line 269, in encode chunks = self.iterencode(o, _one_shot=True) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/encoder.py", line 348, in iterencode return _iterencode(o, 0) File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/ajax.py", line 26, in default return json.JSONEncoder.default(self, obj) File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/encoder.py", line 246, in default raise TypeError(repr(o) + " is not JSON serializable") TypeError: TemplateNotFound() is not JSON serializable -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company --001a113f922e321cfb052c971daf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi

On Wed, Feb 24, 2016 at 9:24 AM, Khushboo Vashi <khushboo.= vashi@enterprisedb.com> wrote:
Hi,

I have updated the Domain mod= ule as below:

- Used 'NodeByListControl' to= get schemas, in domains.js file as suggested by Ashesh to avoid code redun= dancy.

- Applied 'Security Label Macro'=C2=A0 P= atch (Implemented by Harshal) and removed same changes from the Domain Pat= ch.
=C2=A0 To test Domain patch, 'Security Label Macro= 9; patch must be applied first as that is not committed yet.
=
Please find attached Domain Module Patch.

Initial feedback:

- = Owner and schema should be allowed to be left blank (and then default to th= e current user/schema)

- Length and Precision fiel= ds should only be enabled if appropriate for the data type.

<= /div>
- SQL generation for new Domains doesn't work:

=
- When adding constraints, I should be able to type directly int= o the grid. Expanding the row should be optional.

= - The comment column on the constraints grid expands when the text reaches = ~50% of the width. It should be a fixed size (and use 100% of the space ava= ilable, less appropriate margins).

- Backend suppo= rt checks should not special-case Slony schemas.

-= 4 character indentation not used consistently in SQL templates.
=
- Error seen when saving a domain: "macros/schemas/secu= rity.macros"

016-02-25 11:55:10,728: INFO werkzeug: 127.0.0.1 - - [25/Feb/2016 11:55:10] "= GET /browser/domain/msql/1/1/24587/2200/?name=3Demail&owner=3Dpostgres&= amp;basensp=3Dpublic&description=3DThis+is+an+email+data+type&baset= ype=3Dtext&typlen=3D&precision=3D&typdefault=3D&typnotnull= =3Dtrue&collname=3D&constraints=3D%5B%5D&seclabels=3D%5B%5D&= ;_=3D1456401124386 HTTP/1.1" 500 -
Traceback (most recent ca= ll last):
=C2=A0 File "/Users/dpage/.virtualenvs/pgadmin4/li= b/python2.7/site-packages/flask/app.py", line 1836, in __call__
<= div>=C2=A0 =C2=A0 return self.wsgi_app(environ, start_response)
= =C2=A0 File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-pac= kages/flask/app.py", line 1820, in wsgi_app
=C2=A0 =C2=A0 re= sponse =3D self.make_response(self.handle_exception(e))
=C2=A0 Fi= le "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/fla= sk/app.py", line 1403, in handle_exception
=C2=A0 =C2=A0 rer= aise(exc_type, exc_value, tb)
=C2=A0 File "/Users/dpage/.vir= tualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1817= , in wsgi_app
=C2=A0 =C2=A0 response =3D self.full_dispatch_reque= st()
=C2=A0 File "/Users/dpage/.virtualenvs/pgadmin4/lib/pyt= hon2.7/site-packages/flask/app.py", line 1477, in full_dispatch_reques= t
=C2=A0 =C2=A0 rv =3D self.handle_user_exception(e)
= =C2=A0 File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-pac= kages/flask/app.py", line 1381, in handle_user_exception
=C2= =A0 =C2=A0 reraise(exc_type, exc_value, tb)
=C2=A0 File "/Us= ers/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py&qu= ot;, line 1475, in full_dispatch_request
=C2=A0 =C2=A0 rv =3D sel= f.dispatch_request()
=C2=A0 File "/Users/dpage/.virtualenvs/= pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1461, in disp= atch_request
=C2=A0 =C2=A0 return self.view_functions[rule.endpoi= nt](**req.view_args)
=C2=A0 File "/Users/dpage/.virtualenvs/= pgadmin4/lib/python2.7/site-packages/flask/views.py", line 84, in view=
=C2=A0 =C2=A0 return self.dispatch_request(*args, **kwargs)
=C2=A0 File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils= .py", line 248, in dispatch_request
=C2=A0 =C2=A0 return met= hod(*args, **kwargs)
=C2=A0 File "/Users/dpage/git/pgadmin4/= web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init_= _.py", line 277, in wrap
=C2=A0 =C2=A0 return f(*args, **kwa= rgs)
=C2=A0 File "/Users/dpage/git/pgadmin4/web/pgadmin/brow= ser/server_groups/servers/databases/schemas/domains/__init__.py", line= 232, in wrap
=C2=A0 =C2=A0 return f(self, **kwargs)
= =C2=A0 File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_grou= ps/servers/databases/schemas/domains/__init__.py", line 700, in msql
=C2=A0 =C2=A0 status=3D200
=C2=A0 File "/Users/dpag= e/git/pgadmin4/web/pgadmin/utils/ajax.py", line 41, in make_json_respo= nse
=C2=A0 =C2=A0 response=3Djson.dumps(doc, cls=3DDataTypeJSONEn= coder),
=C2=A0 File "/Users/dpage/.virtualenvs/pgadmin4/lib/= python2.7/site-packages/simplejson/__init__.py", line 386, in dumps
=C2=A0 =C2=A0 **kw).encode(obj)
=C2=A0 File "/Users/= dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/encoder.= py", line 269, in encode
=C2=A0 =C2=A0 chunks =3D self.itere= ncode(o, _one_shot=3DTrue)
=C2=A0 File "/Users/dpage/.virtua= lenvs/pgadmin4/lib/python2.7/site-packages/simplejson/encoder.py", lin= e 348, in iterencode
=C2=A0 =C2=A0 return _iterencode(o, 0)
=
=C2=A0 File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/ajax.py&= quot;, line 26, in default
=C2=A0 =C2=A0 return json.JSONEncoder.= default(self, obj)
=C2=A0 File "/Users/dpage/.virtualenvs/pg= admin4/lib/python2.7/site-packages/simplejson/encoder.py", line 246, i= n default
=C2=A0 =C2=A0 raise TypeError(repr(o) + " is not J= SON serializable")
TypeError: TemplateNotFound() is not JSON= serializable=C2=A0


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @p= gsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL = Company
--001a113f922e321cfb052c971daf--