summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
authorHonza Král <honza.kral@gmail.com>2009-09-11 21:23:55 +0000
committerHonza Král <honza.kral@gmail.com>2009-09-11 21:23:55 +0000
commit9222091de8fa2fcb4fedd74ac99b65c88d295135 (patch)
tree32069d6f3f1fce7bc06d257113999f41a0ce31c1 /django/core
parent78d75b86e3e45ec3ca9f2ace21255922046dd509 (diff)
[soc2009/model-validation] Merged to trunk at r11499
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@11513 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core')
-rw-r--r--django/core/management/base.py4
-rw-r--r--django/core/urlresolvers.py11
2 files changed, 13 insertions, 2 deletions
diff --git a/django/core/management/base.py b/django/core/management/base.py
index b5efdbc108..76b9c0967c 100644
--- a/django/core/management/base.py
+++ b/django/core/management/base.py
@@ -398,7 +398,9 @@ def copy_helper(style, app_or_project, name, directory, other_name=''):
if subdir.startswith('.'):
del subdirs[i]
for f in files:
- if f.endswith('.pyc'):
+ if not f.endswith('.py'):
+ # Ignore .pyc, .pyo, .py.class etc, as they cause various
+ # breakages.
continue
path_old = os.path.join(d, f)
path_new = os.path.join(top_dir, relative_dir, f.replace('%s_name' % app_or_project, name))
diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py
index 4f9eb982e2..eedb8f126c 100644
--- a/django/core/urlresolvers.py
+++ b/django/core/urlresolvers.py
@@ -287,8 +287,17 @@ class RegexURLResolver(object):
candidate = result % unicode_kwargs
if re.search(u'^%s' % pattern, candidate, re.UNICODE):
return candidate
+ # lookup_view can be URL label, or dotted path, or callable, Any of
+ # these can be passed in at the top, but callables are not friendly in
+ # error messages.
+ m = getattr(lookup_view, '__module__', None)
+ n = getattr(lookup_view, '__name__', None)
+ if m is not None and n is not None:
+ lookup_view_s = "%s.%s" % (m, n)
+ else:
+ lookup_view_s = lookup_view
raise NoReverseMatch("Reverse for '%s' with arguments '%s' and keyword "
- "arguments '%s' not found." % (lookup_view, args, kwargs))
+ "arguments '%s' not found." % (lookup_view_s, args, kwargs))
def resolve(path, urlconf=None):
return get_resolver(urlconf).resolve(path)