dahlia/sqlalchemy-imageattach

Implicit Contexts with Pyramid

andrewjburnett opened this issue · 0 comments

I am running into an issue when attempting to use implicit contexts within a Pyramid application.

Using Pyramid's built-in BeforeRender event I can call the push_store_context function at the beginning of my request/response lifecycle - this works fine.

However, when using either the finished callback or response callbacks to pop the context at the end of the request I encounter an "IndexError: pop from empty list." I have checked my code to make sure all of the "with store_context(store):" implementations have been removed. Nonetheless, the error still occurs. Does this have something to do with how the contexts are managed internally by sqlalchemy-imageattach? Maybe the context has been emptied by the time the pop_store_context function is being called by the finished_callback at the VERY end of the request/response cycle.