From d66b56f53be3a5c42468be1441688da927357703 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sun, 27 May 2007 11:09:52 +0000 Subject: [PATCH] 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 --- django/conf/urls/defaults.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/django/conf/urls/defaults.py b/django/conf/urls/defaults.py index 1e87ea708a..26cdd3e1ff 100644 --- a/django/conf/urls/defaults.py +++ b/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)