Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1409 (closed enhancement: fixed)

Opened 12 years ago

Last modified 12 years ago

Make session available in templates

Reported by: chrisz Owned by: faide
Priority: normal Milestone: 1.0.3
Component: TurboGears Version: 1.0.2
Severity: normal Keywords:


If session_filter.on is set, then cherrypy.session should be added to the  Global Template Variables under the name tg.session.

Change History

comment:1 Changed 12 years ago by faide

  • Status changed from new to assigned
  • Owner changed from anonymous to faide

do you mean you would like to receive a dictionnary like this one when accessing tg.session in your templates:

{'_id': '1b47be841d8a4416dda1d31a75b04130ef369c70'}

If yes then I can commit right now... if this is something else then you'll have to explain in more details what you expect... :!)

comment:2 Changed 12 years ago by chrisz

Yes, cherrypy.session looks like a dictionary with this session id and keys for your other session variables. But tg.session should really be the cherrypy.session object, not a copy or something, just as cherrypy.request object is exposed as tg.request already.

comment:3 Changed 12 years ago by faide

  • Status changed from assigned to closed
  • Resolution set to fixed

OK then you have it in r3230 (1.0dev) and r3231 (1.1dev)

Cheers! Florent.

comment:4 Changed 12 years ago by chrisz

Thanks! (Is that print statement there intentionally or accidentally?)

Note: See TracTickets for help on using tickets.