Ben Bangert <[EMAIL PROTECTED]> writes:
> You likely have stale objects in the session, are you making sure to
> clear() it or create a new one every request?
No, didn't realize I needed to. I've just done this and it seems to
have fixed the spontaneously changing data I was seeing. Many thanks.
class ClientController(BaseController):
def __before__(self):
self.session = session_context.current
self.session.clear()
So should I be doing this on each __before__() where I get the
session_context.current? Is there any time I would NOT want to dot
his? It's not something I've seen mentioned in the pylons docs and
examples.
This seems a bit verbose if I have to do it in each controller's
__before__(); what's common practice for this? Do you all put it in
the BaseController?
In an IRC log from 2006-12-28 this appears to be a commonly overlooked issue:
matt_good I think that the QuickWiki example needs to add a call
to self.session.clear() in the __before__ method 23:24
matt_good the session appears to leave stale data if you don't clear it
out first 23:24
Windle yes, SQLAlchemy needs to either have clear() called, or have a
new session made 23:25
Windle a new session is slightly faster performance-wise 23:25
Windle I'm actually posting a quick writeup on the two functions in
0.9.4 to aid in that right now 23:25
matt_good ok 23:25
matt_good well, I started an app using the current recommendations from
QuickWiki using the "session_context.current" 23:26
matt_good which is not getting cleared between requests 23:26
Windle yes, that works. just clear it in the __before__ 23:27
Windle or if you upgrade to 0.9.4, there's a make_session which will
create a new one for you 23:27
Thanks again.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---