Author: mtredinnick
Date: 2007-07-13 04:14:51 -0500 (Fri, 13 Jul 2007)
New Revision: 5681
Modified:
django/trunk/django/core/urlresolvers.py
Log:
Fixed #4839 -- Added __repr__ methods to URL classes that show the pattern they
contain. Thanks, Thomas G?\195?\188ttler.
Modified: django/trunk/django/core/urlresolvers.py
===================================================================
--- django/trunk/django/core/urlresolvers.py 2007-07-13 09:09:59 UTC (rev
5680)
+++ django/trunk/django/core/urlresolvers.py 2007-07-13 09:14:51 UTC (rev
5681)
@@ -144,6 +144,9 @@
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 @@
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):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---