Merge lp:~wgrant/launchpad/psycopg2-2.7 into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 18651
Proposed branch: lp:~wgrant/launchpad/psycopg2-2.7
Merge into: lp:launchpad
Diff against target: 63 lines (+9/-9)
3 files modified
constraints.txt (+1/-1)
lib/lp/code/model/branchnamespace.py (+4/-4)
lib/lp/code/model/gitnamespace.py (+4/-4)
To merge this branch: bzr merge lp:~wgrant/launchpad/psycopg2-2.7
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+345500@code.launchpad.net

Commit message

Upgrade to psycopg2 2.7.4. Needed to build against PostgreSQL 10.

Description of the change

I had to flip the order of the bzr/git namespace validation functions so they didn't end up sending NULs to the DB which now crashes psycopg2. Previously the string would apparently be truncated by postgres, which probably means this upgrade causes other paths to crash with ValueErrors in the face of bad input, but better than what we had before.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'constraints.txt'
2--- constraints.txt 2018-05-12 14:16:37 +0000
3+++ constraints.txt 2018-05-14 08:59:58 +0000
4@@ -311,7 +311,7 @@
5 pgbouncer==0.0.8
6 prettytable==0.7.2
7 psutil==5.4.2
8-psycopg2==2.6.1
9+psycopg2==2.7.4
10 pyasn1==0.4.2
11 pyasn1-modules==0.2.1
12 pycparser==2.18
13
14=== modified file 'lib/lp/code/model/branchnamespace.py'
15--- lib/lp/code/model/branchnamespace.py 2017-05-23 12:42:38 +0000
16+++ lib/lp/code/model/branchnamespace.py 2018-05-14 08:59:58 +0000
17@@ -194,10 +194,6 @@
18
19 def validateBranchName(self, name):
20 """See `IBranchNamespace`."""
21- existing_branch = self.getByName(name)
22- if existing_branch is not None:
23- raise BranchExists(existing_branch)
24-
25 # Not all code paths that lead to branch creation go via a
26 # schema-validated form (e.g. pushing a new branch to codehosting),
27 # so we validate the branch name here to give a nicer error message
28@@ -205,6 +201,10 @@
29 # constraint "valid_name"...'.
30 IBranch['name'].validate(unicode(name))
31
32+ existing_branch = self.getByName(name)
33+ if existing_branch is not None:
34+ raise BranchExists(existing_branch)
35+
36 def validateMove(self, branch, mover, name=None):
37 """See `IBranchNamespace`."""
38 if name is None:
39
40=== modified file 'lib/lp/code/model/gitnamespace.py'
41--- lib/lp/code/model/gitnamespace.py 2016-10-14 17:25:51 +0000
42+++ lib/lp/code/model/gitnamespace.py 2018-05-14 08:59:58 +0000
43@@ -138,16 +138,16 @@
44
45 def validateRepositoryName(self, name):
46 """See `IGitNamespace`."""
47- existing_repository = self.getByName(name)
48- if existing_repository is not None:
49- raise GitRepositoryExists(existing_repository)
50-
51 # Not all code paths that lead to Git repository creation go via a
52 # schema-validated form, so we validate the repository name here to
53 # give a nicer error message than 'ERROR: new row for relation
54 # "gitrepository" violates check constraint "valid_name"...'.
55 IGitRepository['name'].validate(unicode(name))
56
57+ existing_repository = self.getByName(name)
58+ if existing_repository is not None:
59+ raise GitRepositoryExists(existing_repository)
60+
61 def validateDefaultFlags(self, repository):
62 """See `IGitNamespace`."""
63 repository_set = getUtility(IGitRepositorySet)