--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-user...@googlegroups.com.
To post to this group, send email to cherryp...@googlegroups.com.
Visit this group at http://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
# authentication decoratordef auth_check():# cherrypy.session.acquire_lock()authenticated = cherrypy.session.get('authenticated', False)# cherrypy.session.save()if not authenticated:raise cherrypy.HTTPRedirect("/account/login")cherrypy.tools.auth_check = cherrypy.Tool("before_handler", auth_check, priority=60)
[29/May/2014:14:15:39] Traceback (most recent call last):File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 104, in runhook()File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 63, in __call__return self.callback(**self.kwargs)File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 784, in savecherrypy.session.save()File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 253, in saveself._save(expiration_time)File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 515, in _saveassert self.locked, ("The session was saved without being locked. "
AssertionError: The session was saved without being locked. Check your tools' priority levels.
ERROR:cherrypy.error.35325776:[29/May/2014:14:15:39] Traceback (most recent call last):File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 104, in runhook()File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 63, in __call__return self.callback(**self.kwargs)File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 784, in savecherrypy.session.save()File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 253, in saveself._save(expiration_time)File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 515, in _saveassert self.locked, ("The session was saved without being locked. "
AssertionError: The session was saved without being locked. Check your tools' priority levels.
[29/May/2014:14:15:39] HTTP Traceback (most recent call last):File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 674, in respond
self.hooks.run('before_finalize')File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 114, in runraise excAssertionError: The session was saved without being locked. Check your tools' priority levels.
ERROR:cherrypy.error.35325776:[29/May/2014:14:15:39] HTTP Traceback (most recent call last):File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 674, in respond
self.hooks.run('before_finalize')File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 114, in runraise excAssertionError: The session was saved without being locked. Check your tools' priority levels.
[29/May/2014:14:43:09] Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 104, in runhook()File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 63, in __call__return self.callback(**self.kwargs)
File "/home/trdis/trdis/tradas/web_ui/pages.py", line 47, in auth_check
authenticated = cherrypy.session.get('authenticated', False)
File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 348, in getself.load()File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 268, in loaddata = self._load()File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 497, in _loadassert self.locked, ("The session load without being locked. "AssertionError: The session load without being locked. Check your tools' priority levels.ERROR:cherrypy.error.43662800:[29/May/2014:14:43:09] Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 104, in runhook()File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 63, in __call__return self.callback(**self.kwargs)
File "/home/trdis/trdis/tradas/web_ui/pages.py", line 47, in auth_check
authenticated = cherrypy.session.get('authenticated', False)
File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 348, in getself.load()File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 268, in loaddata = self._load()File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 497, in _loadassert self.locked, ("The session load without being locked. "AssertionError: The session load without being locked. Check your tools' priority levels.[29/May/2014:14:43:09] HTTP Traceback (most recent call last):File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 667, in respondself.hooks.run('before_handler')
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 114, in runraise exc
AssertionError: The session load without being locked. Check your tools' priority levels.ERROR:cherrypy.error.43662800:[29/May/2014:14:43:09] HTTP Traceback (most recent call last):File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 667, in respondself.hooks.run('before_handler')
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 114, in runraise exc
AssertionError: The session load without being locked. Check your tools' priority levels.
[29/May/2014:14:41:39] Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 104, in runhook()File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 63, in __call__return self.callback(**self.kwargs)File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 784, in savecherrypy.session.save()File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 253, in saveself._save(expiration_time)File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 515, in _saveassert self.locked, ("The session was saved without being locked. "
AssertionError: The session was saved without being locked. Check your tools' priority levels.ERROR:cherrypy.error.67312720:[29/May/2014:14:41:39] Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 104, in runhook()File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 63, in __call__return self.callback(**self.kwargs)File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 784, in savecherrypy.session.save()File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 253, in saveself._save(expiration_time)File "/usr/local/lib/python2.7/dist-packages/cherrypy/lib/sessions.py", line 515, in _saveassert self.locked, ("The session was saved without being locked. "
AssertionError: The session was saved without being locked. Check your tools' priority levels.[29/May/2014:14:41:39] HTTP Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 674, in respondself.hooks.run('before_finalize')File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 114, in runraise exc
AssertionError: The session was saved without being locked. Check your tools' priority levels.ERROR:cherrypy.error.67312720:[29/May/2014:14:41:39] HTTP Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 674, in respondself.hooks.run('before_finalize')File "/usr/local/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 114, in runraise excAssertionError: The session was saved without being locked. Check your tools' priority levels.
--
You received this message because you are subscribed to a topic in the Google Groups "cherrypy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cherrypy-users/bSETdqxB--U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cherrypy-user...@googlegroups.com.
Docs aren't complete there apparently, yes use "early" in place of "implicit"
Look at the source code I cited a few replies back :) that's the exact spot
hooks.attach('before_finalize', _sessions.save) hooks.attach('on_end_request', _sessions.close)
So at the return of every handler, 'before_finalize' the session is saved?Then after finalizing but before the request ends, the session is closed?
So if I were to do explicit locking I would need to call acquire_lock() at the end of every handler method? So that the lock was acquired and it could be saved?
Seems like a lot of work being done even when the session is never being modified?
Thanks!> So at the return of every handler, 'before_finalize' the session is saved?
> Then after finalizing but before the request ends, the session is closed?