From afb23664304a6423a9c7c326343faeae7ef0e035 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 7 Nov 2006 05:05:16 +0000 Subject: [PATCH] Fixed #2875: made urlresolvers.get_mod_func() deal with non-qualified callbacks better. Thanks, Matt McClanahan. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4047 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/urlresolvers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py index 6abd71dc41..93c9c30cca 100644 --- a/django/core/urlresolvers.py +++ b/django/core/urlresolvers.py @@ -21,7 +21,10 @@ class NoReverseMatch(Exception): def get_mod_func(callback): # Converts 'django.views.news.stories.story_detail' to # ['django.views.news.stories', 'story_detail'] - dot = callback.rindex('.') + try: + dot = callback.rindex('.') + except ValueError: + return callback, '' return callback[:dot], callback[dot+1:] def reverse_helper(regex, *args, **kwargs):