Author: adrian
Date: 2007-03-20 11:48:41 -0500 (Tue, 20 Mar 2007)
New Revision: 4756

Modified:
   django/trunk/django/shortcuts/__init__.py
Log:
Fixed #3767 -- Added reason to Http404 exception raised in get_object_or_404 
and get_list_or_404

Modified: django/trunk/django/shortcuts/__init__.py
===================================================================
--- django/trunk/django/shortcuts/__init__.py   2007-03-20 16:21:17 UTC (rev 
4755)
+++ django/trunk/django/shortcuts/__init__.py   2007-03-20 16:48:41 UTC (rev 
4756)
@@ -19,7 +19,7 @@
     try:
         return manager.get(*args, **kwargs)
     except klass.DoesNotExist:
-        raise Http404
+        raise Http404('No %s matches the given query.' % 
klass._meta.object_name)
 
 def get_list_or_404(klass, *args, **kwargs):
     if isinstance(klass, Manager):
@@ -28,5 +28,5 @@
         manager = klass._default_manager
     obj_list = list(manager.filter(*args, **kwargs))
     if not obj_list:
-        raise Http404
+        raise Http404('No %s matches the given query.' % 
manager.model._meta.object_name)
     return obj_list


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

Reply via email to