Skip to content

Commit

Permalink
series: Only accept integers in the detailed series URL
Browse files Browse the repository at this point in the history
We were trying to find a series with a primary key not being an integer
otherwise, resulting in a ValueError and an HTTP error 500.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
  • Loading branch information
Damien Lespiau committed Nov 14, 2015
1 parent 5a6a034 commit d2505da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions patchwork/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ def testStringRepresentation(self):
revision = series.revisions()[0]
self.assertEquals(str(revision), 'Revision 1')

class SeriesViewTest(GeneratedSeriesTest):
def testSeriesIdNotInteger(self):
response = self.client.get('/series/foo/')
self.assertEqual(response.status_code, 404)

class IntelGfxTest(SeriesTest):
project = Project(linkname = 'intel-gfx',
name = 'Intel Gfx',
Expand Down
2 changes: 1 addition & 1 deletion patchwork/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
# series views
url(r'^project/(?P<project>[^/]+)/series/$', SeriesListView.as_view(),
name='series_list'),
(r'^series/(?P<series>[^/]+)/$', SeriesView.as_view()),
(r'^series/(?P<series>\d+)/$', SeriesView.as_view()),

# patch views
(r'^patch/(?P<patch_id>\d+)/$', 'patchwork.views.patch.patch'),
Expand Down

0 comments on commit d2505da

Please sign in to comment.