Michael Bayer ha scritto: > Manlio Perillo wrote: >> Regards. >> >> I need to know if the __init__ and close methods of the Session object >> *never* raise an exception. > > nothing *never* raises an exception. > if you pass along bad arguments,
Well, the two function are under "my control". > youll get an exception. theres no database operations or per-object > assertions within __init__ or close if thats what you mean. > Thanks. The reason for this question is that I'm doing: def _sessionTransaction(self, callable_, *args, **kwargs): from sqlalchemy import orm conn = self.contextual_connect() sess = orm.create_session(bind_to=conn) # This cannot fail try: trans = sess.create_transaction() try: ret = callable_(conn, sess, *args, **kwargs) trans.commit() return ret except: trans.rollback() raise finally: sess.close() # This cannot fail conn.close() So it is important that create_session and sess.close never raise an exception. If this is not the case, I have to add another try statement. Regards Manlio Perillo > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---