Ok, per request, here is the change I made to my code:
def getSessionVariables(self, kw={}):
'''Updates the cherrypy.session collection with the kw args
from a page request'''
# These are the variables I want available on every page
variables = {'topTags': tagCloud(), 'category': 'all',
'stories': [], 'profile': None,
'data': None, 'pageType': None, 'loggedin': False,
'TREND': 1, 'OVER': -1,
'PAGELEN': 20, 'pagenum': 0}
for field in variables:
if not field in cherrypy.session:
cherrypy.session[field] = variables[field]
#clear the error message
cherrypy.session['errormessage'] = ''
# Update the current page number (if given)
if 'page' in kw and int(kw['page']):
cherrypy.session['pagenum'] = int(kw['page'])-1
# Randomly select a featured profile
cherrypy.session['featured'] = featuredProfile()
# Return the session collection; return from a calling function
using
# s = self.getSessionVariables()
# ... # do stuff...
# return dict(s)
return cherrypy.session
[EMAIL PROTECTED] wrote:
> Aha! That fixed it. By updating my local variables from
> cherrypy.session and running on that, I was actually enforcing a single
> set of values across all sessions. Moral: Keep all thread-specific
> variables in cherrypy.session.
>
> Thanks a million!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---