Re: Pgadmin4: emoji in comments - Mailing list pgadmin-hackers

From Dave Page
Subject Re: Pgadmin4: emoji in comments
Date
Msg-id 61D2007C-6CEE-496C-9D74-5478B169E53F@pgadmin.org
Whole thread Raw
In response to Re: Pgadmin4: emoji in comments  (Murtuza Zabuawala <murtuza.zabuawala@enterprisedb.com>)
Responses Re: Pgadmin4: emoji in comments  (Murtuza Zabuawala <murtuza.zabuawala@enterprisedb.com>)
List pgadmin-hackers
Is the newer version of psycopg2 actually released? If so, this should be a non-issue in a fresh venv right?

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

EnterpriseDB UK:http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On 10 Jun 2016, at 08:02, Murtuza Zabuawala <murtuza.zabuawala@enterprisedb.com> wrote:

Hi,

This seems to issue with psycopg2. (https://github.com/psycopg/psycopg2/issues/331)

To resolve this issue we have two solutions,

Solution-1
we can upgrade the psycopg2 module to newer version 

Solution-2
Re-write of our 'qtLiteral' implementation which also accepts current connection object as parameter and using that we can prepare "adapt" for encoding used by current connection but this will affects almost every module (sql template related changes).

Regards,
Murtuza



--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


On Mon, Jun 6, 2016 at 1:32 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Fri, Jun 3, 2016 at 11:28 PM, eMerzh <merzhin@gmail.com> wrote:
> Hi,
>
> i just pulled the latest git,
> and tried to display a table with an emoji in comments of the table
> and i got an exception...
>
> using python3.5
> 4398d1d8694024b3f357e74fba4683d5f3cd5745
>
> here is the traceback
>
> 2016-06-04 00:23:15,050: ERROR    pgadmin:    Exception on
> /browser/table/sql/1/1/25554/2200/34037 [GET]
> Traceback (most recent call last):
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py", line
> 1817, in wsgi_app
>     response = self.full_dispatch_request()
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py", line
> 1477, in full_dispatch_request
>     rv = self.handle_user_exception(e)
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py", line
> 1381, in handle_user_exception
>     reraise(exc_type, exc_value, tb)
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/_compat.py",
> line 33, in reraise
>     raise value
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py", line
> 1475, in full_dispatch_request
>     rv = self.dispatch_request()
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py", line
> 1461, in dispatch_request
>     return self.view_functions[rule.endpoint](**req.view_args)
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/views.py",
> line 84, in view
>     return self.dispatch_request(*args, **kwargs)
>   File "/tmp/pgadmin4/web/pgadmin/browser/utils.py", line 233, in
> dispatch_request
>     return method(*args, **kwargs)
>   File
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
> line 328, in wrap
>     return f(*args, **kwargs)
>   File
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
> line 2437, in sql
>     data=data, conn=self.conn)
>   File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/templating.py", line
> 128, in render_template
>     context, ctx.app)
>   File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/templating.py", line
> 110, in _render
>     rv = template.render(context)
>   File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/environment.py",
> line 969, in render
>     return self.environment.handle_exception(exc_info, True)
>   File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/environment.py",
> line 742, in handle_exception
>     reraise(exc_type, exc_value, tb)
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/_compat.py",
> line 36, in reraise
>     raise value.with_traceback(tb)
>   File
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/create.sql",
> line 123, in <module>
>     IS {{c.description|qtLiteral}};
>   File "/tmp/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py", line
> 1405, in qtLiteral
>     res = adapt(value).getquoted()
> UnicodeEncodeError: 'latin-1' codec can't encode character '\U0001f4a9' in
> position 6: ordinal not in range(256)
> 2016-06-04 00:23:17,443: ERROR    pgadmin:    Exception on
> /browser/table/sql/1/1/25554/2200/34037 [GET]
> Traceback (most recent call last):
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py", line
> 1817, in wsgi_app
>     response = self.full_dispatch_request()
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py", line
> 1477, in full_dispatch_request
>     rv = self.handle_user_exception(e)
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py", line
> 1381, in handle_user_exception
>     reraise(exc_type, exc_value, tb)
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/_compat.py",
> line 33, in reraise
>     raise value
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py", line
> 1475, in full_dispatch_request
>     rv = self.dispatch_request()
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/app.py", line
> 1461, in dispatch_request
>     return self.view_functions[rule.endpoint](**req.view_args)
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/views.py",
> line 84, in view
>     return self.dispatch_request(*args, **kwargs)
>   File "/tmp/pgadmin4/web/pgadmin/browser/utils.py", line 233, in
> dispatch_request
>     return method(*args, **kwargs)
>   File
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
> line 328, in wrap
>     return f(*args, **kwargs)
>   File
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
> line 2437, in sql
>     data=data, conn=self.conn)
>   File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/templating.py", line
> 128, in render_template
>     context, ctx.app)
>   File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/flask/templating.py", line
> 110, in _render
>     rv = template.render(context)
>   File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/environment.py",
> line 969, in render
>     return self.environment.handle_exception(exc_info, True)
>   File
> "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/environment.py",
> line 742, in handle_exception
>     reraise(exc_type, exc_value, tb)
>   File "/tmp/pgadmin4/venv3/lib/python3.5/site-packages/jinja2/_compat.py",
> line 36, in reraise
>     raise value.with_traceback(tb)
>   File
> "/tmp/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/create.sql",
> line 123, in <module>
>     IS {{c.description|qtLiteral}};
>   File "/tmp/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py", line
> 1405, in qtLiteral
>     res = adapt(value).getquoted()
> UnicodeEncodeError: 'latin-1' codec can't encode character '\U0001f4a9' in
> position 6: ordinal not in range(256)
>
> btw, sorry to reach you guys directly but i can't post on *-hackers and
> don't think there is a bug tracker somewhere?

You seem to have posted on -hackers, though I had to approve it :-)

The bug tracker can be found here:
https://redmine.postgresql.org/projects/pgadmin4/issues

I'll log this one for now - thanks!

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

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

pgadmin-hackers by date:

Previous
From: Surinder Kumar
Date:
Subject: [pgAdmin4][Patch]: RM#1327 After selecting the expiry date for role , the calendar box not disappearing
Next
From: Murtuza Zabuawala
Date:
Subject: Re: Pgadmin4: emoji in comments