aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/app.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-04-29 12:15:25 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-04-29 12:18:34 +1200
commitf03ce8107075567ea902b88ace2964ee035d45aa (patch)
treedd0e06fc9ddf4c4b9d04807aff18eea72d4bf52f /libpathod/app.py
parent2d88d88f8c27b50f5d4d532ae54a8c643e6dc868 (diff)
downloadmitmproxy-f03ce8107075567ea902b88ace2964ee035d45aa.tar.gz
mitmproxy-f03ce8107075567ea902b88ace2964ee035d45aa.tar.bz2
mitmproxy-f03ce8107075567ea902b88ace2964ee035d45aa.zip
Anchor management: list and remove anchors.
Diffstat (limited to 'libpathod/app.py')
-rw-r--r--libpathod/app.py22
1 files changed, 19 insertions, 3 deletions
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