Added leading slash to output of core.urlresolvers.reverse(), and made 'urlconf' a keyword argument

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3470 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-07-28 02:08:17 +00:00
parent e3bb401181
commit 36ee8f5ad2
1 changed files with 2 additions and 2 deletions

View File

@ -209,11 +209,11 @@ def resolve(path, urlconf=None):
resolver = RegexURLResolver(r'^/', urlconf) resolver = RegexURLResolver(r'^/', urlconf)
return resolver.resolve(path) return resolver.resolve(path)
def reverse(viewname, urlconf, args=None, kwargs=None): def reverse(viewname, urlconf=None, args=None, kwargs=None):
args = args or [] args = args or []
kwargs = kwargs or {} kwargs = kwargs or {}
if urlconf is None: if urlconf is None:
from django.conf import settings from django.conf import settings
urlconf = settings.ROOT_URLCONF urlconf = settings.ROOT_URLCONF
resolver = RegexURLResolver(r'^/', urlconf) resolver = RegexURLResolver(r'^/', urlconf)
return resolver.reverse(viewname, *args, **kwargs) return '/' + resolver.reverse(viewname, *args, **kwargs)