From b27c54c257efc77cd405b000bf02b82053b72305 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Tue, 6 Nov 2012 16:04:36 -0800 Subject: [PATCH] Add a helpful __repr__ implementation to URLSpec. --- tornado/web.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tornado/web.py b/tornado/web.py index 68bf78b1..7d179482 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -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.