The problem is that it requires the explicit use of the session.
In my case this means that I can not delete the object inside a method
of my class.

class A(object):
    def enableB(enable=True):
       if enable:
          self.b = B(...)
       else:
          del self.b


Not a big problem, however.


There's the 'threadlocal' that should let you work as you like, but I've
read its use is discouraged because it could lead to strange bugs.

BTW, couldn't you just pass your session to the methods requiring it?

class A(object):
   def enableB(enable=True, session):
      if enable:
         self.b = B(...)
      else:
         session.delete(self.b)




--
Alan Franzoni <[EMAIL PROTECTED]>
-
Togli .xyz dalla mia email per contattarmi.
Remove .xyz from my address in order to contact me.
-
GPG Key Fingerprint (Key ID = FE068F3E):
5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to