Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Report an error if urlpatterns contain a string view name and it is e…

…mpty.

Refs #4319.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5360 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit d66b56f53be3a5c42468be1441688da927357703 1 parent 451cbfe
@malcolmt malcolmt authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 django/conf/urls/defaults.py
View
8 django/conf/urls/defaults.py
@@ -1,4 +1,5 @@
from django.core.urlresolvers import RegexURLPattern, RegexURLResolver
+from django.core.exceptions import ImproperlyConfigured
__all__ = ['handler404', 'handler500', 'include', 'patterns', 'url']
@@ -22,7 +23,10 @@ def url(regex, view, kwargs=None, name=None, prefix=''):
# For include(...) processing.
return RegexURLResolver(regex, view[0], kwargs)
else:
- if prefix and isinstance(view, basestring):
- view = prefix + '.' + view
+ if isinstance(view, basestring):
+ if not view:
+ raise ImproperlyConfigured('Empty URL pattern view name not permitted (for pattern %r)' % regex)
+ if prefix:
+ view = prefix + '.' + view
return RegexURLPattern(regex, view, kwargs, name)
Please sign in to comment.
Something went wrong with that request. Please try again.