Decorouter 0.0.2

A WSGI routing apparatus
Decorouter is a WSGI routing app that makes it easy to define routes using decorator syntax.

Example:


from decorouter import Router

class MyApplication:
 router = Router()

 @router.add('/$')
 def index(self, environ, start_response):
 start_response('200 OK', [('Content-type', 'text/plain')])
 return ['Hello, world!']

 @router.add('/hello/([^/]+)$')
 def index(self, environ, start_response):
 args, kwargs = environ['wsgiorg.routing_args']
 (name,) = args
 start_response('200 OK', [('Content-type', 'text/plain')])
 return ['Hello, %s!' % (name,)]

 def __call__(self, environ, start_response):
 return self.router(environ, start_response)

if __name__ == '__main__':
 from wsgiref.simple_server import make_server
 make_server('', 8000, MyApplication()).serve_forever()

last updated on:
November 3rd, 2011, 15:12 GMT
price:
FREE!
developed by:
David Zuwenden
homepage:
github.com
license type:
MIT/X Consortium License 
category:
ROOT \ Internet \ HTTP (WWW)

FREE!

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Rate it!

Add your review!

SUBMIT