List Info

Thread: sessions and digest_auth




sessions and digest_auth
country flaguser name
United States
2007-05-29 14:23:33
Can sessions be used when using digest_auth?

When I add sessions to the digest_auth I got from the CP
book (using
CP 3.0.1), I get the following:

[30/May/2007:02:01:53]  Traceback (most recent call last):
  File
"/usr/local/lib/python2.4/site-packages/cherrypy/_cpeng
ine.py",
line 244, in release
    req.close()
  File
"/usr/local/lib/python2.4/site-packages/cherrypy/
_cprequest.py", line 424, in close
    self.hooks.run('on_end_request')
  File
"/usr/local/lib/python2.4/site-packages/cherrypy/
_cprequest.py", line 90, in run
    hook()
  File
"/usr/local/lib/python2.4/site-packages/cherrypy/
_cprequest.py", line 58, in __call__
    return self.callback(**self.kwargs)
  File
"/usr/local/lib/python2.4/site-packages/cherrypy/lib/
sessions.py", line 417, in close
    sess = cherrypy.session
AttributeError: 'module' object has no attribute 'session'

The example code I am using is:
import cherrypy

class Root:
  cherrypy.expose
  def index(self):
    return
"""<html<head></head>
<body>
  <a href="admin">Admin Area</a>
</body>
</html>
"""

class Admin:
  cherrypy.expose
  def index(self):
    return "This is a private area"

if __name__ == '__main__':

  def get_users():
    return {'test':'test'}

  conf = {'/admin': {'tools.digest_auth.on': True,
                     'tools.digest_auth.realm':
'localhost',
                     'tools.digest_auth.users': get_users,
                     'tools.sessions.on': True, }}

  root = Root()
  root.admin = Admin()
  cherrypy.quickstart(root, '/', config=conf)

Thanks,
ax25


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: sessions and digest_auth
country flaguser name
United States
2007-05-29 14:49:33
I applied the session patch from Ticket #680 and the code
works now.

Thanks,
ax25


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at h
ttp://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )