Merge lp:~cjwatson/storm/remove-psycopg-unicode-workaround into lp:storm

Proposed by Colin Watson
Status: Merged
Merged at revision: 496
Proposed branch: lp:~cjwatson/storm/remove-psycopg-unicode-workaround
Merge into: lp:storm
Diff against target: 20 lines (+0/-10)
1 file modified
storm/databases/postgres.py (+0/-10)
To merge this branch: bzr merge lp:~cjwatson/storm/remove-psycopg-unicode-workaround
Reviewer Review Type Date Requested Status
Adam Collard (community) Approve
Review via email: mp+368224@code.launchpad.net

Commit message

Remove PostgresConnection.raw_execute workaround for lack of Unicode queries.

Description of the change

This workaround was added in 2007, and presumably there was some psycopg2 problem at the time that required it. However, I've tested as far back as psycopg2 2.0.10 (the oldest version still available on PyPI) and there's no sign of it; I've also successfully run the full Launchpad test suite without this workaround. I think this must have been a psycopg2 bug that was fixed a long time ago, and it now seems to be safe to drop the workaround.

(My motivation here is that it's one fewer thing that needs porting to Python 3.)

To post a comment you must log in.
Revision history for this message
Adam Collard (adam-collard) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'storm/databases/postgres.py'
2--- storm/databases/postgres.py 2016-04-28 11:57:12 +0000
3+++ storm/databases/postgres.py 2019-06-01 10:57:46 +0000
4@@ -305,16 +305,6 @@
5
6 return Connection.execute(self, statement, params, noresult)
7
8- def raw_execute(self, statement, params):
9- """
10- Like L{Connection.raw_execute}, but encode the statement to
11- UTF-8 if it is unicode.
12- """
13- if type(statement) is unicode:
14- # psycopg breaks with unicode statements.
15- statement = statement.encode("UTF-8")
16- return Connection.raw_execute(self, statement, params)
17-
18 def to_database(self, params):
19 """
20 Like L{Connection.to_database}, but this converts datetime

Subscribers

People subscribed via source and target branches

to status/vote changes: