Use get_object_or_404() or make a try/raise block with raise Http404.

On 1/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

I'm not sure why this throws a 500 error rather than a 404, but I'm
hoping somebody can help.

On my site, each forum has a slug... site.com/foo-bar/

but if someone types in site.com/foobar/ it gives a 500 error.
Traceback says "DoesNotExist: Forum matching query does not exist."
which makes sense.

Relevant url is:
(r'^(?P<forum_slug>[-\w]+)/$', 'views.topic_list'),

I'm trying to figure out how to capture a non forum_slug and either
route them to the right place if possible, or at least give them a 404.

--
Julio Nobrega - http://www.inerciasensorial.com.br

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to