Changeset 8672 for django/trunk/django/core/urlresolvers.py
- Timestamp:
- 08/28/08 14:05:14 (3 months ago)
- Files:
-
- django/trunk/django/core/urlresolvers.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/urlresolvers.py
r8664 r8672 53 53 if func_name != '': 54 54 lookup_view = getattr(__import__(mod_name, {}, {}, ['']), func_name) 55 if not callable(lookup_view): 56 raise AttributeError("'%s.%s' is not a callable." % (mod_name, func_name)) 55 57 except (ImportError, AttributeError): 56 58 if not can_fail: … … 197 199 try: 198 200 lookup_view = getattr(__import__(mod_name, {}, {}, ['']), func_name) 199 except (ImportError, AttributeError): 200 raise NoReverseMatch 201 except ImportError, e: 202 raise NoReverseMatch("Could not import '%s': %s" % (mod_name, e)) 203 except AttributeError, e: 204 raise NoReverseMatch("'%s' has no attribute '%s'" % (mod_name, func_name)) 201 205 if lookup_view != self.callback: 202 raise NoReverseMatch 206 raise NoReverseMatch("Reversed view '%s' doesn't match the expected callback ('%s')." % (viewname, self.callback)) 203 207 return self.reverse_helper(*args, **kwargs) 204 208 … … 280 284 try: 281 285 lookup_view = get_callable(lookup_view, True) 282 except (ImportError, AttributeError) :283 raise NoReverseMatch(" '%s' is not a callable." % lookup_view)286 except (ImportError, AttributeError), e: 287 raise NoReverseMatch("Error importing '%s': %s." % (lookup_view, e)) 284 288 if lookup_view in self.reverse_dict: 285 289 return u''.join([reverse_helper(part.regex, *args, **kwargs) for part in self.reverse_dict[lookup_view]]) 286 raise NoReverseMatch("Reverse for '%s' not found." % lookup_view) 290 raise NoReverseMatch("Reverse for '%s' with arguments '%s' and keyword " 291 "arguments '%s' not found." % (lookup_view, args, kwargs)) 287 292 288 293 def reverse_helper(self, lookup_view, *args, **kwargs):
