Commits

Mathijs de Bruin  committed bc02392

Remove explicit 404 - use urlpattern

  • Participants
  • Parent commits 233f4a3

Comments (0)

Files changed (2)

File newsletter/urls.py

 
     # Action confirmation views
     surl('^<newsletter_slug:s>/subscription/<email=[-_a-zA-Z0-9@\.\+~]+>/'
-         '<action:s>/activate/<activation_code:s>/$',
+         '<action=subscribe|update|unsubscribe>/activate/<activation_code:s>/$',
         'update_subscription', name='newsletter_update_activate'),
     surl('^<newsletter_slug:s>/subscription/<email=[-_a-zA-Z0-9@\.\+~]+>/'
-         '<action:s>/activate/$',
+         '<action=subscribe|update|unsubscribe>/activate/$',
         'update_subscription', name='newsletter_update'),
 
     # Archive views

File newsletter/views.py

 def update_subscription(request, newsletter_slug,
         email, action, activation_code=None):
 
-    if not action in ['subscribe', 'update', 'unsubscribe']:
-        # TODO: Test coverage of this branch
-        raise Http404
+    assert action in ['subscribe', 'update', 'unsubscribe']
 
     my_newsletter = get_object_or_404(Newsletter.on_site, slug=newsletter_slug)
     my_subscription = get_object_or_404(