From f2cc404d7f003ec7043623a1ab3a0e262dc3931e Mon Sep 17 00:00:00 2001 From: John Piasetzki Date: Wed, 19 Oct 2016 23:41:22 -0400 Subject: [PATCH] Remove simple router --- sanic/router.py | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/sanic/router.py b/sanic/router.py index e6c580d7..a4ac68bb 100644 --- a/sanic/router.py +++ b/sanic/router.py @@ -113,34 +113,3 @@ class Router: return route.handler, args, kwargs else: raise NotFound("Requested URL {} not found".format(request.url)) - - -class SimpleRouter: - """ - Simple router records and reads all routes from a dictionary - It does not support parameters in routes, but is very fast - """ - routes = None - - def __init__(self): - self.routes = {} - - def add(self, uri, methods, handler): - # Dict for faster lookups of method allowed - methods_dict = None - if methods: - methods_dict = {method: True for method in methods} - self.routes[uri] = Route( - handler=handler, methods=methods_dict, pattern=uri, - parameters=None) - - def get(self, request): - route = self.routes.get(request.url) - if route: - if route.methods and request.method not in route.methods: - raise InvalidUsage( - "Method {} not allowed for URL {}".format( - request.method, request.url), status_code=405) - return route.handler, [], {} - else: - raise NotFound("Requested URL {} not found".format(request.url))