Add a helpful __repr__ implementation to URLSpec. #627

Merged
merged 1 commit into from Nov 11, 2012
Jump to file
+5 −0
Split
View
@@ -2002,6 +2002,11 @@ def __init__(self, pattern, handler_class, kwargs=None, name=None):
self.name = name
self._path, self._group_count = self._find_groups()
+ def __repr__(self):
+ return '%s(%r, %s, kwargs=%r, name=%r)' % \
+ (self.__class__.__name__, self.regex.pattern,
+ self.handler_class, self.kwargs, self.name)
+
def _find_groups(self):
"""Returns a tuple (reverse string, group count) for a url.