Tipfy, NDB and @context.toplevel

16 views
Skip to first unread message

Noah McIlraith

unread,
Jun 18, 2011, 3:19:48 AM6/18/11
to ti...@googlegroups.com
Is there a better place to put @context.toplevel then at the top of all my get() and post() handler methods?

I'm not particularly familiar with how WSGI works, is it okay to decorate the main() function with @context.toplevel?

Rodrigo Moraes

unread,
Jun 18, 2011, 9:13:04 AM6/18/11
to tipfy
On Jun 18, 4:19 am, Noah McIlraith wrote:
> Is there a better place to put @context.toplevel then at the top of all my
> get() and post() handler methods?

You can override dispatch() in a base handler:

class BaseHandler(RequestHandler):
@context.toplevel
def dispatch(self):
super(BaseHandler, self).dispatch()

> I'm not particularly familiar with how WSGI works, is it okay to decorate
> the main() function with @context.toplevel?

That won't work. :)

-- rodrigo
Reply all
Reply to author
Forward
0 new messages