Thanks for the prompt response, Ben.

On Jun 24, 12:14 pm, Ben Bangert <[email protected]> wrote:
> On Jun 24, 2010, at 8:51 AM, dave wrote:
>
> >  File "/Users/dave/om/trunk/OpenMile/openmile/model/authtoken.py",
> > line 122, in forToken
> >    meta.Session.add(at)
>
> Where is this bit called from? If its being triggered on some import, 
> *before* the engine initialization code in environment.py, then it could 
> cause this problem.
SQLAlchemy is setup in the environment.py file generally, with the
init_model call. So the db shouldn't be used until after that call
completes.

SQLAlchemy is setup - we can issue other commands to the db. We simply
can't add this unattached object to the Session. That being said, no
SELECT queries have been issued before this point.


>
> > We can make this problem go away one of two ways: 1) flush the cache
> > (not desirable.) 2) Issue a request to the server that does not invoke
> > the caching code. After we issue a single, quick working request,
> > subsequent requests work fine everything is happy.
>
> > It seems to me that this is a bug. When I start the server, shouldn't
> > Pylons have SQLAlchemy fully set up? What magic is the first request
> > doing that is being missed?
>
> None, do you mean that the first request to the server after it starts up 
> does not work, but later ones do?

No requests that try to add the cached object to the Session work
until after we have at least one succesful request. E.g. if I restart
the server, all requests fail in the authentication middleware until I
explicitly send one request that skips the authentication process
(which is where this code is located.)


-dave

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to