Metadata-Version: 1.0
Name: platypus-router
Version: 0.1.1
Summary: Django like WSGI router
Home-page: https://github.com/platypus-creation/platypus-router/
Author: Vincent Jauneau
Author-email: vincent.jauneau@platypus-creation.com
License: Copyright (c) 2011 Vincent Jauneau

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Description: Django-like WSGI router.
        
        from router.core import router
        
        # Define a controller
        def hello(request, name, template='Hello %s'):
           	return template % name
        
        # Register routes
        router.add(r'^/hello/(?P<name>[\w_-]+)/$', hello)
        router.add(r'^/hello/my/name/is/(?P<name>[\w_-]+)/$', hello, template='Hello my name is %s', name='hello_my_name_is')
        
        # Serve WSGI application
        from wsgiref.simple_server import make_server
        
        server = make_server('localhost', 8000, router)
        server.serve_forever()
        
           # Reverse controller URL
        router.reverse(hello, name='Vincent') # /hello/Vincent/
        router.reverse('hello_my_name_is', name='Vincent') # /hello/my/name/is/Vincent/
        
Keywords: platypus,router,routing,wsgi,django
Platform: UNKNOWN
