how about 'contextualsession' or something....I really dislike the
name "contextsession".
also i dont understand how sticking a __call__() on SessionContext
would have any impact on its existing get/set/del operations.
On May 1, 2006, at 9:45 PM, Daniel Miller wrote:
Michael Bayer wrote:
I havent done anything with SessionContext as of yet, but i had in
mind that __sessioncontext__ would return a callable. when you
call that returned callable, you get the session.
So would it work like this:
callable = MyClass.__sessioncontext__
session = callable()
or like this:
callable = MyClass.__sessioncontext__()
session = callable()
I'm not really liking the second one because it requires this to
get a session directly from the object:
session = MyClass.__sessioncontext__()()
which is ugly and confusing IMHO.
on SessionContext this would mean just implementing __call__().
as hibernate's CurrentSessionContext is an interface with just a
single method "currentSession()", it is very common that the
Python counterpart to a one-line Java interface is just a callable
(since Python can pass around callables!).
SessionContext's "current" property is more powerful than
Hibernates equivalent currentSession() method because it allows
get, set, and del. Also, if you really want to implement a __call__
method on SessionContext then we should just make it extend
ScopedRegistry rather than wrapping it since ScopedRegistry already
implements __call__ (less method calls => faster). I think an
attribute is the most natural (it's probably what Hibernate would
use if Java had properties like Python). I still hold to my
suggestion to name it to __contextsession__(). It should be a
callable that returns a Session instance. Then if you want to pass
around a callable it can be done like this:
session_getter = MyClass.__contextsession__
And if you just want a session do it like this:
session = MyClass.__contextsession__()
~ Daniel
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your
job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?
cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users