its not a bug to pass create_session to scoped_session either - you just don't 
get to use configure().  we could even catch the AttributeError here and add 
friendliness.


On May 10, 2010, at 2:27 PM, David Gardner wrote:

> Yeah, the docs are confusing on this one:
> http://www.sqlalchemy.org/docs/reference/orm/sessions.html?highlight=sessionmaker#sqlalchemy.orm.scoped_session
> "Parameters: * session_factory – a callable function that produces Session 
> instances, such as sessionmaker() or create_session()."
> 
> Also I took a peak at the unittests to see if any of them passed 
> create_session into sessionmaker, and noticed that
> test/orm/test_scoping.py uses it.
> 
> On 05/10/2010 10:07 AM, Michael Bayer wrote:
>> its not a bug.     this is why the docs illustrate it using sessionmaker().  
>> If there's some doc that says "it just takes a callable", we should add 
>> verbiage that the "configure" process has additional requirements.
>> 
>> 
>> 
>> On May 10, 2010, at 12:51 PM, David Gardner wrote:
>> 
>>   
>>> Not sure if this is a bug or not, but I am not able to call configure() on 
>>> a ScopedSession that was created with create_session as it's argument.
>>> I can work around this by using sessionmaker instead, but thought I should 
>>> report it as it maybe a bug.
>>> 
>>> On a side note, I get the same behavior with 0.5.8 and 0.5.6 which leads me 
>>> to believe this isn't a bug.
>>> ---------------------------
>>> 
>>> Python 2.6.5 (r265:79063, Apr 20 2010, 19:39:53)
>>> [GCC 4.4.3] on linux2
>>> Type "help", "copyright", "credits" or "license" for more information.
>>>     
>>>>>> from sqlalchemy.orm import scoped_session, create_session
>>>>>> Session = scoped_session(create_session)
>>>>>> Session.configure
>>>>>>           
>>> <bound method ScopedSession.configure 
>>> of<sqlalchemy.orm.scoping.ScopedSession object at 0x171d890>>
>>>     
>>>>>> Session.configure()
>>>>>>           
>>> Traceback (most recent call last):
>>>  File "<stdin>", line 1, in<module>
>>>  File 
>>> "/users/dgardner/src/pcs/branches/pylons/lib/python2.6/site-packages/SQLAlchemy-0.6.0-py2.6.egg/sqlalchemy/orm/scoping.py",
>>>  line 87, in configure
>>>    self.session_factory.configure(**kwargs)
>>> AttributeError: 'function' object has no attribute 'configure'
>>>     
>>>>>>           
>>> -- 
>>> David Gardner
>>> Pipeline Tools Programmer
>>> Jim Henson Creature Shop
>>> dgard...@creatureshop.com
>>> 
>>> 
>>> -- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "sqlalchemy" group.
>>> To post to this group, send email to sqlalch...@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.
>>> 
>>>     
>>   
> 
> 
> -- 
> David Gardner
> Pipeline Tools Programmer
> Jim Henson Creature Shop
> dgard...@creatureshop.com
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@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.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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