sess_auth?

View: New views
2 Messages — Rating Filter:   Alert me  

sess_auth?

by Eric Abrahamsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My session authorization recently stopped working – I suspect it's after I updated to 301.0rc1, because I don't think I've changed any code... My usage is about as simple as it gets:


main.py
======
# import handlers

root = MainPage()
root.articles = Articles()
root.interior = Interior()

if __name__ == '__main__':
    cherrypy.tree.mount(root, '/', config='config')
    cherrypy.config.update({'server.socket_host':'127.0.0.1','server.socket_port':8085})
    cherrypy.engine.start()
    cherrypy.engine.block()

=====
config
=====
[global]
tools.sessions.on = True
tools.sessions.storage_type = 'file'
tools.sessions.storage_path = '/storage/path'
tools.sessions.timeout = 60

[/interior]
tools.session_auth.on = True
tools.session_auth.realm = '127.0.0.1'
tools.session_auth.users = {...}


If I try to visit anything under /interior/, it gives me this traceback:

Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/cherrypy/_cprequest.py", line 603, in respond
    self.hooks.run('before_handler')
  File "/Library/Python/2.5/site-packages/cherrypy/_cprequest.py", line 98, in run
    hook()
  File "/Library/Python/2.5/site-packages/cherrypy/_cprequest.py", line 58, in __call__
    return self.callback(**self.kwargs)
  File "/Library/Python/2.5/site-packages/cherrypy/_cptools.py", line 158, in _wrapper
    if self.callable(**kwargs):
  File "/Library/Python/2.5/site-packages/cherrypy/lib/cptools.py", line 280, in session_auth
    return sa.run()
  File "/Library/Python/2.5/site-packages/cherrypy/lib/cptools.py", line 273, in run
    return self.do_check()
  File "/Library/Python/2.5/site-packages/cherrypy/lib/cptools.py", line 248, in do_check
    sess = cherrypy.session
AttributeError: 'module' object has no attribute 'session'

Have I done something wrong here? Anywhere else the problem could be coming from?




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


Re: sess_auth?

by Eric Abrahamsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Fixed it: The basic session tool config needed to go under a [/]
block, not [global].


On May 28, 4:52 pm, Eric Abrahamsen <gir...@...> wrote:

> My session authorization recently stopped working – I suspect it's  
> after I updated to 301.0rc1, because I don't think I've changed any  
> code... My usage is about as simple as it gets:
>
> main.py
> ======
> # import handlers
>
> root = MainPage()
> root.articles = Articles()
> root.interior = Interior()
>
> if __name__ == '__main__':
>      cherrypy.tree.mount(root, '/', config='config')
>
> cherrypy
> .config.update({'server.socket_host':'127.0.0.1','server.socket_port':
> 8085})
>      cherrypy.engine.start()
>      cherrypy.engine.block()
>
> =====
> config
> =====
> [global]
> tools.sessions.on = True
> tools.sessions.storage_type = 'file'
> tools.sessions.storage_path = '/storage/path'
> tools.sessions.timeout = 60
>
> [/interior]
> tools.session_auth.on = True
> tools.session_auth.realm = '127.0.0.1'
> tools.session_auth.users = {...}
>
> If I try to visit anything under /interior/, it gives me this traceback:
>
> Traceback (most recent call last): File "/Library/Python/2.5/site-
> packages/cherrypy/_cprequest.py", line 603, in respond  
> self.hooks.run('before_handler') File "/Library/Python/2.5/site-
> packages/cherrypy/_cprequest.py", line 98, in run hook() File "/
> Library/Python/2.5/site-packages/cherrypy/_cprequest.py", line 58, in  
> __call__ return self.callback(**self.kwargs) File "/Library/Python/2.5/
> site-packages/cherrypy/_cptools.py", line 158, in _wrapper if  
> self.callable(**kwargs): File "/Library/Python/2.5/site-packages/
> cherrypy/lib/cptools.py", line 280, in session_auth return sa.run()  
> File "/Library/Python/2.5/site-packages/cherrypy/lib/cptools.py", line  
> 273, in run return self.do_check() File "/Library/Python/2.5/site-
> packages/cherrypy/lib/cptools.py", line 248, in do_check sess =  
> cherrypy.session AttributeError: 'module' object has no attribute  
> 'session'
>
> Have I done something wrong here? Anywhere else the problem could be  
> coming from?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users@...
To unsubscribe from this group, send email to cherrypy-users-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---