changeset 4906:b860ede03056 routing

routing: Add example URL map
author anatoly techtonik <techtonik@gmail.com>
date Tue, 15 Jul 2014 13:42:57 +0300
parents 6e313bdf6b69
children c37069a99cec
files roundup/web/NOTES.md roundup/web/router.py
diffstat 2 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/web/NOTES.md	Tue Jul 15 13:33:43 2014 +0300
+++ b/roundup/web/NOTES.md	Tue Jul 15 13:42:57 2014 +0300
@@ -34,7 +34,26 @@
 
 Status for Roundup URL map check:
 
-    [ ] urlmap component
+    [ ] check urlpath values for
+      [ ] example.com
+      [ ] example.com/
+      [ ] example.com/tracker
+      [ ] example.com/tracker/
+      [ ] example.com/tracker/item
+      [ ] example.com/tracker?anything
+      [ ] example.com/tracker/?anything
+      [ ] example.com/tracker/item?anything
+
+    [ ] get full list of url handlers
+
+    [ ] check url handling for db scheme paths
+
+      [ ] example.com/tracker/class
+      [ ] example.com/tracker/class/
+      [ ] example.com/tracker/class1
+      [ ] example.com/tracker/class1/
+
+    [ ] check url handling for static files
 
     /_file/(.*) 
       StaticFileHandler
@@ -46,3 +65,4 @@
        [ ] /@@file
        [ ] /@@file/
        [ ] /@@file/name
+
--- a/roundup/web/router.py	Tue Jul 15 13:33:43 2014 +0300
+++ b/roundup/web/router.py	Tue Jul 15 13:42:57 2014 +0300
@@ -10,6 +10,26 @@
 import re
 
 
+# --- Example URL mapping
+
+class NamedObject(object):
+    """Object that outputs given name when printed"""
+    def __init__(self, name):
+        self.name = name
+    def __repr__(self):
+        return self.name
+
+ExampleHandler = NamedObject('ExampleHandler')
+ExampleFileHandler = NamedObject('ExampleFileHandler')
+
+EXAMPLE_URLMAP = (
+    '/static/(.*)', ExampleFileHandler,
+    '/', ExampleHandler
+)
+
+
+# --- Regexp based router
+
 class Router(object):
 
     def __init__(self, urlmap=[]):

Roundup Issue Tracker: http://roundup-tracker.org/