1
0
mirror of https://github.com/django/django.git synced 2024-12-23 09:36:06 +00:00

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:
Malcolm Tredinnick 2007-05-27 11:09:52 +00:00
parent 451cbfe894
commit d66b56f53b

View File

@ -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)