Question

I am using python bottle with Beaker to manage Http sessions. So far I know how to set beaker session timeout parameters, and the sessions are cleaned automatically once expired, but I need to do extra DB cleanup when a session expired.

does anyone know how to receive a callback when a beaker session expired? Thanks a lot :D

No correct solution

OTHER TIPS

I'm unfamiliar with beaker, so this is just a wild guess, but can you subclass beaker.session.Session?

If so, then your new class could do its cleanup in __del__.

Something along these lines:

class MySession(beaker.session.Session):
    def __init__(self, *args, **kwargs):
        super(MySession, self).__init__(self, *args, **kwargs)

    def __del__(self):
        # your cleanup here

(Or maybe it's the expire method that you need to define. Not sure, since I've never used beaker.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top