Hi, I was wondering if the pylons.c object is completely threadsafe at all times during the lifecycle of a request.
My app is handling requests for multiple domains and I assign a Website sqlalchemy object to the c object in the __before__ method of my BaseController: try: d = dbsession.query(Domain).filter_by(name=hostname).one() except DoesNotExist: abort(404) self.website = d.website c.WEBSITE = d.website I sometimes see the following error: File '<string>', line 1 in <lambda> File './app/lib/decorators.py', line 60 in wrapper File './lib/python2.4/site-packages/Beaker-0.9-py2.4.egg/beaker/ cache.py', line 51 in get File './lib/python2.4/site-packages/Beaker-0.9-py2.4.egg/beaker/ container.py', line 433 in get_value File './app/lib/decorators.py', line 51 in create_func File './app/controllers/site_country.py', line 37 in show File './app/models/objects.py', line 437 in _get_datasite File './lib/python2.4/site-packages/SQLAlchemy-0.4.2p3-py2.4.egg/ sqlalchemy/orm/attributes.py', line 44 in __get__ File './lib/python2.4/site-packages/SQLAlchemy-0.4.2p3-py2.4.egg/ sqlalchemy/orm/attributes.py', line 223 in get File './lib/python2.4/site-packages/SQLAlchemy-0.4.2p3-py2.4.egg/ sqlalchemy/orm/strategies.py', line 441 in __call__ InvalidRequestError: Parent instance <class 'app.models.objects.Website'> is not bound to a Session, and no contextual session is established; lazy load operation of attribute 'parent' cannot proceed This is a cache-decorated controller call in the context of create_func in said decorator. _get_datasite is a property to a foreign key relationship on Website. Apparently the Website object referenced by c.WEBSITE and controller_obj.website is no longer attached to a session. The only time I clear the session is in the __call__ method in the finally block after WSGIController.__call__ I am deploying the app as: use = egg:Paste#flup_fcgi_thread This problem is hard to reproduce, but it happens frequently enough to ignore. Any ideas what's causing this? Thanks, Bob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
