Re: Handling bad URLs

2007-01-05 Thread Adrian Holovaty
On 1/5/07, James Bennett <[EMAIL PROTECTED]> wrote: I wonder if maybe it would help if ObjectDoesNotExist were to become a subclass of Http404, so that an uncaught ObjectDoesNotExist exception would just become a 404... No can do -- that would couple the database layer to HTTP, which wouldn't

Re: Handling bad URLs

2007-01-05 Thread [EMAIL PROTECTED]
Thanks! --~--~-~--~~~---~--~~ 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 m

Re: Handling bad URLs

2007-01-05 Thread James Bennett
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. Typically, the pattern is to catch ObjectDoesNotExist and either recover from it or raise Http404; ObjectDoesNotExist is there to let you have a

Re: Handling bad URLs

2007-01-05 Thread Julio Nobrega
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 t