Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #4839 -- Added __repr__ methods to URL classes that show the pa…

…ttern they

contain. Thanks, Thomas Güttler.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5681 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 53e3f76d6ec5c450ab2d711368e0dd72bc39dfec 1 parent 92f54af
@malcolmt malcolmt authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 django/core/urlresolvers.py
View
6 django/core/urlresolvers.py
@@ -144,6 +144,9 @@ def __init__(self, regex, callback, default_args=None, name=None):
self.default_args = default_args or {}
self.name = name
+ def __repr__(self):
+ return '<%s %s %s>' % (self.__class__.__name__, self.name, self.regex.pattern)
+
def add_prefix(self, prefix):
"""
Adds the prefix string to a string-based callback.
@@ -205,6 +208,9 @@ def __init__(self, regex, urlconf_name, default_kwargs=None):
self.default_kwargs = default_kwargs or {}
self._reverse_dict = {}
+ def __repr__(self):
+ return '<%s %s %s>' % (self.__class__.__name__, self.urlconf_name, self.regex.pattern)
+
def _get_reverse_dict(self):
if not self._reverse_dict and hasattr(self.urlconf_module, 'urlpatterns'):
for pattern in reversed(self.urlconf_module.urlpatterns):
Please sign in to comment.
Something went wrong with that request. Please try again.