Report an error if urlpatterns contain a string view name and it is empty.
Refs #4319. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5360 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
451cbfe894
commit
d66b56f53b
|
@ -1,4 +1,5 @@
|
||||||
from django.core.urlresolvers import RegexURLPattern, RegexURLResolver
|
from django.core.urlresolvers import RegexURLPattern, RegexURLResolver
|
||||||
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
|
|
||||||
__all__ = ['handler404', 'handler500', 'include', 'patterns', 'url']
|
__all__ = ['handler404', 'handler500', 'include', 'patterns', 'url']
|
||||||
|
|
||||||
|
@ -22,7 +23,10 @@ def url(regex, view, kwargs=None, name=None, prefix=''):
|
||||||
# For include(...) processing.
|
# For include(...) processing.
|
||||||
return RegexURLResolver(regex, view[0], kwargs)
|
return RegexURLResolver(regex, view[0], kwargs)
|
||||||
else:
|
else:
|
||||||
if prefix and isinstance(view, basestring):
|
if isinstance(view, basestring):
|
||||||
view = prefix + '.' + view
|
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)
|
return RegexURLPattern(regex, view, kwargs, name)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue