Add a helpful __repr__ implementation to URLSpec.

This commit is contained in:
Jon Parise 2012-11-06 16:04:36 -08:00
parent 958301dd96
commit b27c54c257
1 changed files with 5 additions and 0 deletions

View File

@ -2002,6 +2002,11 @@ class URLSpec(object):
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.