On Tue, Dec 19, 2006 at 10:54:12AM +0100, jose wrote:
> 
>     1         import cherrypy 
> 2      
> 3     @turbogears.expose(html="myproject.templates.counter") 
> 4     def counter(self): 
> 5         # Session variable initialization (or recall if exists) 
> 6         cherrypy.session['count'] = cherrypy.session.get('count', 0)  
> 7       
> 8         # Variable assignment 
> 9         cherrypy.session['count'] = cherrypy.session['count'] + 1 
> 10      
> 11        #Return the value to your template 
> 12        return dict(counter=cherrypy.session['count']) 
> 
> 
> I'm trying to use sessions....
> but ....
did you enable sessions in the config file (dev.cfg)?

session_filter.on=True

> 
> print cherrypy.session.get('count',0)
> 
> *** AttributeError: 'thread._local' object has no attribute 'request'
> 
> What am I doing wrong?
> 
> jo
> 
> 
> --~--~---------~--~----~------------~-------~--~----~
>  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?hl=en
> -~----------~----~----~----~------~----~------~--~---

Attachment: pgpEXZ4ILObzS.pgp
Description: PGP signature

Reply via email to