Dear all,
please consider the following code-block:

class SQLAlchemySessionMiddleware(object):
    """
    This class instantiates a sqlalchemy session and destroys
    """
    def process_request(self, request):
        request.db_session = session()
        return None

    def process_response(self, request, response):
        session_destroy(request.db_session)
        return response

Consider that session() is method that returns a new object sqlalchemy
session.
I want to inject it before view is processed and destroy it upon
exiting the view.

I have added the path of this middleware class before XView
middleware in settings.py.
But i got a error that
request has not attribute 'db_session' ( process_response function)
How can i do it?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to