On Feb 26, 1:20 am, Chris Withers <ch...@simplistix.co.uk> wrote:
> On 26/02/2011 09:09, Romy wrote:
>
> > It sounds like a better approach would be to wrap each request
> > handler's code as follows:
>
> > try:
> >    RequestHandler()
> >    elixir.session.commit()
> > except:
> >    elixir.session.rollback()
> >    raise
> > finally:
> >    elixir.session.remove()
>
> > Q1: Is this, in fact, the better approach ?
>
> Yep, that looks about right.
>
> > Q2: If so, I already have a whole bunch of RequestHandlers written, so
> > the only way I can think of making this change efficiently is by
> > modifying Tornado's internals, which I'd prefer not to do.
>
> Does Tornado do wsgi?

Yes, pretty sure it can.

> > Are there
> > other options ? I guess with_session type decorators are on the table
> > as well, but will be pretty repetitive since all the handlers need
> > sessions.
>
> Do your RequestHandler's share a common base?
> Sounds like they should, and that base's __call__ method should to the
> try/except/finally above.

Hmm, the handlers aren't callable, but do have get() and post()
methods that handle the appropriate HTTP request. How would you
recommend modifying the base handler to wrap everything ?

Thanks sir.

>
> cheers,
>
> Chris
>
> --
> Simplistix - Content Management, Batch Processing & Python Consulting
>             -http://www.simplistix.co.uk

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to