From f03ce8107075567ea902b88ace2964ee035d45aa Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 29 Apr 2012 12:15:25 +1200 Subject: Anchor management: list and remove anchors. --- libpathod/app.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'libpathod/app.py') diff --git a/libpathod/app.py b/libpathod/app.py index 51bd014b..ac118602 100644 --- a/libpathod/app.py +++ b/libpathod/app.py @@ -86,19 +86,35 @@ class PathodApp(tornado.web.Application): def __init__(self, application, request, **settings): Pathod.__init__(self, spec, application, request, **settings) FixedPathod.spec = spec + FixedPathod.pattern = pattern l.insert(0, tornado.web.URLSpec(pattern, FixedPathod, self.appsettings)) - def get_anchors(self, pattern, spec): + def get_anchors(self): """ Anchors are added to the beginning of the handlers. """ - pass + l = self.handlers[0][1] + a = [] + for i in l: + if i.handler_class.__name__ == "FixedPathod": + a.append( + ( + i.handler_class.pattern, + i.handler_class.spec + ) + ) + return a def remove_anchor(self, pattern, spec): """ Anchors are added to the beginning of the handlers. """ - pass + l = self.handlers[0][1] + for i, h in enumerate(l): + if h.handler_class.__name__ == "FixedPathod": + if (h.handler_class.pattern, h.handler_class.spec) == (pattern, spec): + del l[i] + return # begin nocover -- cgit v1.2.3