← Back to team overview

launchpad-reviewers team mailing list archive

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

 

William Grant has proposed merging lp:~wgrant/launchpad/psycopg2-2.7 into lp:launchpad.

Commit message:
Upgrade to psycopg2 2.7.4. Needed to build against PostgreSQL 10.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/psycopg2-2.7/+merge/345500

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.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/psycopg2-2.7 into lp:launchpad.
=== modified file 'constraints.txt'
--- constraints.txt	2018-05-12 14:16:37 +0000
+++ constraints.txt	2018-05-14 08:59:58 +0000
@@ -311,7 +311,7 @@
 pgbouncer==0.0.8
 prettytable==0.7.2
 psutil==5.4.2
-psycopg2==2.6.1
+psycopg2==2.7.4
 pyasn1==0.4.2
 pyasn1-modules==0.2.1
 pycparser==2.18

=== modified file 'lib/lp/code/model/branchnamespace.py'
--- lib/lp/code/model/branchnamespace.py	2017-05-23 12:42:38 +0000
+++ lib/lp/code/model/branchnamespace.py	2018-05-14 08:59:58 +0000
@@ -194,10 +194,6 @@
 
     def validateBranchName(self, name):
         """See `IBranchNamespace`."""
-        existing_branch = self.getByName(name)
-        if existing_branch is not None:
-            raise BranchExists(existing_branch)
-
         # Not all code paths that lead to branch creation go via a
         # schema-validated form (e.g. pushing a new branch to codehosting),
         # so we validate the branch name here to give a nicer error message
@@ -205,6 +201,10 @@
         # constraint "valid_name"...'.
         IBranch['name'].validate(unicode(name))
 
+        existing_branch = self.getByName(name)
+        if existing_branch is not None:
+            raise BranchExists(existing_branch)
+
     def validateMove(self, branch, mover, name=None):
         """See `IBranchNamespace`."""
         if name is None:

=== modified file 'lib/lp/code/model/gitnamespace.py'
--- lib/lp/code/model/gitnamespace.py	2016-10-14 17:25:51 +0000
+++ lib/lp/code/model/gitnamespace.py	2018-05-14 08:59:58 +0000
@@ -138,16 +138,16 @@
 
     def validateRepositoryName(self, name):
         """See `IGitNamespace`."""
-        existing_repository = self.getByName(name)
-        if existing_repository is not None:
-            raise GitRepositoryExists(existing_repository)
-
         # Not all code paths that lead to Git repository creation go via a
         # schema-validated form, so we validate the repository name here to
         # give a nicer error message than 'ERROR: new row for relation
         # "gitrepository" violates check constraint "valid_name"...'.
         IGitRepository['name'].validate(unicode(name))
 
+        existing_repository = self.getByName(name)
+        if existing_repository is not None:
+            raise GitRepositoryExists(existing_repository)
+
     def validateDefaultFlags(self, repository):
         """See `IGitNamespace`."""
         repository_set = getUtility(IGitRepositorySet)


Follow ups