On Jul 9, 2006, at 11:52 AM, Michael Bayer wrote:

>
> On Jul 9, 2006, at 9:55 AM, Charles Duffy wrote:
>
>>
>> Hrm. I'll need to go back and look into it some -- when dmiller's
>> approach made the issue I was having go away, I pretty much stopped
>> looking into *why* that issue was happening.
>
>
> were you overriding things with SessionContext ?  I notice you had
> some probs with the "current" property on SessionContext, which I
> notice is set up in a non-polymorphic way, i.e.:
>
>      current = property(get_current, set_current, del_current)
>
> i often set those up like this:
>
>       current = property(lambda s:s.get_current(), lambda s:s.set_current
> (), lambda s:s.del_current())
>
> which allows an overridden version of get_current() etc. to properly
> work with the property.
>

So that's why you do properties like that. Wow, that's a performance  
killer if there ever was one. I'm not sure if it matters in this case  
but I just thought I'd mention it. I'm beginning to see why you  
wanted to have a function to get the current session rather than a  
property...hmmm, I'll have to think about that some more.

However, in the original case that brought this up I would argue that  
the Objectstore class should not extend SessionContext. Otherwise it  
superimposes the interface for the session context with that of the  
current session. That will tempt developers to check a session  
instance for a "current" property thinking they can treat it like an  
session context. That's bad--if some function needs a SessionContext  
instance then it should require that interface only. If it needs a  
Session instance then it should require that interface. But it should  
not ask for a Session and then try to treat it like a SessionContext  
or visa-versa. If someone really needs a single object that is both a  
SessionContext and a Session at the same time then they can create  
their own object that proxies both or whatever...but we shouldn't  
encourage that.

~ 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

Reply via email to