launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25470
[Merge] ~cjwatson/launchpad:stop-encoding-for-psycopg2 into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:stop-encoding-for-psycopg2 into launchpad:master.
Commit message:
Stop unnecessarily encoding text for psycopg2
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/392053
This used to be necessary with very old versions of psycopg2, but anything approximately modern (at least 2.3, I think) supports Unicode queries.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:stop-encoding-for-psycopg2 into launchpad:master.
diff --git a/lib/lp/registry/personmerge.py b/lib/lp/registry/personmerge.py
index 8e63a36..7873a61 100644
--- a/lib/lp/registry/personmerge.py
+++ b/lib/lp/registry/personmerge.py
@@ -947,7 +947,7 @@ def merge_people(from_person, to_person, reviewer, delete=False):
''' % vars())
# Append a -merged suffix to the person's name.
- name = base = "%s-merged" % from_person.name.encode('ascii')
+ name = base = "%s-merged" % from_person.name
cur.execute("SELECT id FROM Person WHERE name = %s" % sqlvalues(name))
i = 1
while cur.fetchone():
diff --git a/lib/lp/registry/tests/test_person_sort_key.py b/lib/lp/registry/tests/test_person_sort_key.py
index 0bae018..25aa81c 100644
--- a/lib/lp/registry/tests/test_person_sort_key.py
+++ b/lib/lp/registry/tests/test_person_sort_key.py
@@ -72,11 +72,8 @@ class TestPersonSortKeyInDatabase(TestPersonSortKeyBase, TestCase):
Note that although the stored procedure returns a UTF-8 encoded
string, our database driver converts that to Unicode for us.
'''
- # Note that as we are testing a PostgreSQL stored procedure, we should
- # pass it UTF-8 encoded strings to match our database encoding.
self.cur.execute(
- "SELECT person_sort_key(%s, %s)", (
- display_name.encode("UTF-8"), name.encode("UTF-8")))
+ "SELECT person_sort_key(%s, %s)", (display_name, name))
return self.cur.fetchone()[0]
def assertSortKeysEqual(self, display_name, name, expected):