← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wgrant/launchpad/bug-736633 into lp:launchpad

 

William Grant has proposed merging lp:~wgrant/launchpad/bug-736633 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #736633 in Launchpad itself: "Old librarian URL error handling broken"
  https://bugs.launchpad.net/launchpad/+bug/736633

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bug-736633/+merge/53746

The librarian's old URL handler (parsing paths of the form /content/alias/filename) breaks when handling a non-integral alias ID. Trivial fix.
-- 
https://code.launchpad.net/~wgrant/launchpad/bug-736633/+merge/53746
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bug-736633 into lp:launchpad.
=== modified file 'lib/canonical/librarian/ftests/test_web.py'
--- lib/canonical/librarian/ftests/test_web.py	2011-02-24 04:33:55 +0000
+++ lib/canonical/librarian/ftests/test_web.py	2011-03-17 06:56:36 +0000
@@ -159,9 +159,11 @@
         old_url = uri_path_replace(url, str(aid), '42/%d' % aid)
         self.assertEqual(urlopen(old_url).read(), 'sample')
 
-        # If the content id is not an integer, a 404 is raised
+        # If the content and alias IDs are not integers, a 404 is raised
         old_url = uri_path_replace(url, str(aid), 'foo/%d' % aid)
         self.require404(old_url)
+        old_url = uri_path_replace(url, str(aid), '%d/foo' % aid)
+        self.require404(old_url)
 
     def test_404(self):
         client = LibrarianClient()

=== modified file 'lib/canonical/librarian/web.py'
--- lib/canonical/librarian/web.py	2010-10-25 20:42:59 +0000
+++ lib/canonical/librarian/web.py	2011-03-17 06:56:36 +0000
@@ -80,7 +80,7 @@
                 self.aliasID = int(filename)
             except ValueError:
                 log.msg(
-                    "404 (old URL): alias is not an int: %r" % (name,))
+                    "404 (old URL): alias is not an int: %r" % (filename,))
                 return fourOhFour
             filename = request.postpath[0]