aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libpathod/app.py22
-rw-r--r--notes10
-rw-r--r--test/test_app.py8
-rw-r--r--todo11
4 files changed, 33 insertions, 18 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
diff --git a/notes b/notes
index c70021fe..3d3d9f34 100644
--- a/notes
+++ b/notes
@@ -33,16 +33,10 @@ Examples:
200:b1k:xr
-Sequences:
-
- 200 * 2 | !forever
- 200 | 404 | 200,b:500g
-
-
Anchors:
- Passed on command-line?
- --anchor /foo/bar 200:!/foo
+ Passed on command-line:
+ -a "/foo/bar=200:!/foo"
Built-in help
diff --git a/test/test_app.py b/test/test_app.py
index 3a147385..e0060e82 100644
--- a/test/test_app.py
+++ b/test/test_app.py
@@ -6,7 +6,13 @@ class uApplication(libpry.AutoTree):
def test_anchors(self):
a = app.PathodApp(staticdir=None)
a.add_anchor("/foo", "200")
- assert a.handlers[0][1][0].handler_class.__name__ == "FixedPathod"
+ assert a.get_anchors() == [("/foo", "200")]
+ a.add_anchor("/bar", "400")
+ assert a.get_anchors() == [("/bar", "400"), ("/foo", "200")]
+ a.remove_anchor("/bar", "400")
+ assert a.get_anchors() == [("/foo", "200")]
+ a.remove_anchor("/oink", "400")
+ assert a.get_anchors() == [("/foo", "200")]
class uPages(libpry.AutoTree):
diff --git a/todo b/todo
index 05be23e4..28e64b55 100644
--- a/todo
+++ b/todo
@@ -1,6 +1,5 @@
-
-- Anchors
-- Logs, log reset, log retrieval
-- Add anchors programmatically?
-
-- Sequences
+- Disconnect or pause at specified byte offset
+- Logs
+- API
+ - Logs, log reset, log retrieval
+ - Anchor management