-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Nice little routes decorator you have there. I've just started playing around with python again and using tornado web framework.
Everything works, however just not sure if this the best approach using your route decorator with multiple handlers?
Thanks
# handlers/__init__.py
from handlers.base import route
from handlers import base, home, summary
routes = route.get_routes()# handlers/base.py
from vendor.router import route
from tornado.web import RequestHandler
class BaseHandler(RequestHandler):
pass# handlers/home.py
from handlers.base import route, BaseHandler
@route('/', name='home')
class HomeHandler(BaseHandler):
def get(self):
self.write({'home': {}})# handlers/summary.py
from handlers.base import route, BaseHandler
@route('/summary', name='summary',
class SummaryHandler(BaseHandler):
def get(self):
self.write({'summary': {})# app.py
from handlers import route
print(route.get_routes())Metadata
Metadata
Assignees
Labels
No labels