Hi,
I am getting 'SessionNotEnabledError' when I execute
'tut07_sessions.py' from cherrypy tutorials. This error is coming after
I had installed TurboGears.
I have done 'cherrypy.config.update({'session_filter.on': True})'.
I beleive that TurboGears is using modified version of cherrypy,
because if I work with default cherrypy installation, this tutorial
code works fine without any problems.
Please Let me know how to deal with this problem,
or if there is any other way to start sessions in TurboGears installed
Cherrypy?
The error log
--------------------------------------------------------
2006/08/07 11:54:40 INFO Traceback (most recent call last):
File
"c:\python24\lib\site-packages\CherryPy-2.1.1-py2.4.egg\cherrypy\_cphttpt
ools.py", line 271, in run
main()
File
"c:\python24\lib\site-packages\CherryPy-2.1.1-py2.4.egg\cherrypy\_cphttpt
ools.py", line 502, in main
body = page_handler(*args, **cherrypy.request.paramMap)
File "tut07_sessions.py", line 17, in index
count = cherrypy.session.get('count', 0) + 1
File
"c:\python24\lib\site-packages\CherryPy-2.1.1-py2.4.egg\cherrypy\lib\filt
er\sessionfilter.py", line 442, in __getattr__
raise SessionNotEnabledError()
SessionNotEnabledError
-------------------------------------------------------
The code I am executing is 'tut07_sessions.py' from cherrypy tutorials.
This code executes fine from default cherrypy installation, but gives
above error in TG cherrypy installation.
The code
----------------------------------------------------------
import cherrypy
class HitCounter:
def index(self):
# Increase the silly hit counter
count = cherrypy.session.get('count', 0) + 1
# Store the new value in the session dictionary
cherrypy.session['count'] = count
# And display a silly hit count message!
return '''
During your current session, you've viewed this
page %s times! Your life is a patio of fun!
''' % count
index.exposed = True
cherrypy.root = HitCounter()
cherrypy.config.update({'session_filter.on': True})
if __name__ == '__main__':
cherrypy.config.update(file = 'tutorial.conf')
cherrypy.server.start()
----------------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---