remove unused map.py
authorTero Marttila <terom@fixme.fi>
Thu, 12 Feb 2009 22:51:08 +0200
changeset 60 616ab1e5b593
parent 59 3b9a95c333e5
child 61 fd3570a9dc37
remove unused map.py
map.py
urltree.py
--- a/map.py	Thu Feb 12 01:53:21 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-"""
-    Handles mapping URLs to request handlers
-"""
-
-from qmsk.web import http, handler
-
-class MapperError (http.ResponseError) :
-    """
-        URL could not be mapped
-    """
-
-    def __init__ (self, url) :
-        super(MapperError, self).__init__("URL not found: %s" % (url, ), status='404 Not Found')
-
-class Mapper (handler.RequestHandler) :
-    """
-        Looks up the handler to use based on the URL
-    """
-
-    def handle_request (self, request) :
-        """
-            Map the given request
-        """
-
-        abstract
-
-class Mapping (object) :
-    """
-        A mapping object for StaticMapping
-    """
-
-    def test (self, request) :
-        """
-            Either return a handler, or None
-        """
-
-        abstract
-
-class RegexpMapping (object) :
-    """
-        A mapping object that uses regular expressions
-    """
-
-    def __init__ (self, regexp, handler) :
-        pass
-
-    def test (self, request) :
-        xxx
-
-class SimpleMapping (object) :
-    """
-        A mapping object that uses simple expressions
-    """
-
-    def __init__ (self, expression, handler) :
-        pass
-
-    def test (self, request) :
-        xxx
-
-class StaticMapper (Mapper) :
-    """
-        Translates requests to handlers using a list of pre-determined Mapping's
-    """
-
-    def __init__ (self, mappings) :
-        # store
-        self.mappings = mappings
-
-    def handle_request (self, request) :
-        """
-            Returns the appropriate handler
-        """
-
-        # find handler to use
-        handler = None
-
-        # just test each mapping in turn
-        for mapping in self.mappings :
-            handler = mapping.test(request)
-
-            if handler :
-                break
-        
-        if not handler :
-            # fail, not found
-            raise MapperError(request.get_page_name())
-        
-        # passthrough
-        return handler.handle_request(request)
-
-# "friendly" names
-map     = SimpleMapping
-mapre   = RegexpMapping
-
--- a/urltree.py	Thu Feb 12 01:53:21 2009 +0200
+++ b/urltree.py	Thu Feb 12 22:51:08 2009 +0200
@@ -5,7 +5,7 @@
 import re
 import os.path
 
-from qmsk.web import map
+from qmsk.web import handler
 
 class URLError (Exception) :
     """
@@ -870,7 +870,7 @@
     def __str__ (self) :
         return "%s/[%s]" % (self.label, ','.join(str(child) for child in self.children))
 
-class URLTree (map.Mapper) :
+class URLTree (handler.RequestHandler) :
     """
         Map requests to handlers, using a defined tree of URLs
     """