From: | Harshal Dhumal <harshal(dot)dhumal(at)enterprisedb(dot)com> |
---|---|
To: | Dave Page <dpage(at)pgadmin(dot)org> |
Cc: | pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org> |
Subject: | Re: Patch for RM1500 other issues [pgAdmin4] |
Date: | 2016-08-03 11:43:44 |
Message-ID: | CAFiP3vyNABWTtNK+rtOByWOyeotHQFT7Kv_1jnrKORGTFBobaQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-hackers |
Hi Dave,
This because on python 2.X simplejson throws KeyError instead of TypeError
if any error occurs while loading json data from given object. Now I have
handled that exception as well in attached patch.
I'm sending this as separate patch instead part of RM1500.
--
*Harshal Dhumal*
*Software Engineer*
EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
On Wed, Aug 3, 2016 at 4:12 PM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
> Hi
>
> On Wed, Aug 3, 2016 at 7:36 AM, Harshal Dhumal
> <harshal(dot)dhumal(at)enterprisedb(dot)com> wrote:
> > Hi,
> >
> > PFA patch for RM1500.
> >
> > Changes/Issues fixed:
> >
> > 1] datamodel.js: For collection type added check before adding model into
> > "changed" list instead of adding it blindly.
> >
> > 2] Type casting from str to int of column properties like attlen,
> > attpricision.
> >
> > 3] Added missing data formating when adding new column to existing table
> > (from table edit mode).
> >
> > 4] Added more validation for Foreign key constraint.
> >
> > 5] Column.js: Column grid (in table edit mode) show proper disabled color
> > for disabled cell when grid renders.
> >
> > 6] All constraints and index js added idattribute to distinguish which
> > s/constraint or s/index is updated on server side.
> >
> > 7] Column update.sql: Fixed sql when altering column data type. The issue
> > was when we alter data type from which has length and precision to data
> type
> > which don't have these properties and vice versa.
> > For e.g. alter data type numeric(10,12) to real (and vice versa)
> >
> > 8] Renaming constraint (RM1500).
>
> I get the following error when renaming a primary key. I have
> restarted my app sever and done a hard reload/clear cache on my
> browser. The generated SQL is:
>
> ALTER TABLE public.foo
> RENAME CONSTRAINT foo_pkey TO foo_pkey1;
>
>
> 2016-08-03 11:39:43,764: INFO werkzeug: 127.0.0.1 - - [03/Aug/2016
> 11:39:43] "PUT /browser/table/obj/1/1/12403/2200/158521 HTTP/1.1" 500
> -
> Traceback (most recent call last):
> File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
> line 2000, in __call__
> return self.wsgi_app(environ, start_response)
> File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
> line 1991, 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 1567, in handle_exception
> reraise(exc_type, exc_value, tb)
> File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
> line 1988, in wsgi_app
> response = self.full_dispatch_request()
> File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
> line 1641, in full_dispatch_request
> rv = self.handle_user_exception(e)
> File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
> line 1544, in handle_user_exception
> reraise(exc_type, exc_value, tb)
> File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
> line 1639, in full_dispatch_request
> rv = self.dispatch_request()
> File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py",
> line 1625, 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
> 235, in dispatch_request
> return method(*args, **kwargs)
> File
> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
> line 331, in wrap
> return f(*args, **kwargs)
> File
> "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
> line 1446, in update
> data[k] = json.loads(v, encoding='utf-8')
> File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/__init__.py",
> line 533, in loads
> return cls(encoding=encoding, **kw).decode(s)
> File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/decoder.py",
> line 370, in decode
> obj, end = self.raw_decode(s)
> File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/decoder.py",
> line 395, in raw_decode
> ord0 = ord(s[idx])
> KeyError: 0
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
Attachment | Content-Type | Size |
---|---|---|
simplejson_handle_load_exception_on_python_2.X.X.patch | text/x-patch | 5.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Khushboo Vashi | 2016-08-03 12:01:57 | [pgAdmin][Patch]: Fixed RM 1470 |
Previous Message | Dave Page | 2016-08-03 10:42:53 | Re: Patch for RM1500 other issues [pgAdmin4] |