Since I figured out the problems here with some help on #turbogears IRC
I thought a reply to my own question was in order. Here is how I got
grabbed the identity of the current user and used it to populate the
session dict. In this controller 'User' is the standard User model you
get when you invoke a new project with Identity. I added a few columns
to it to customize for my own needs and have made comments in the code
to that effect.


    def index(self):
        """initialize session dict with user's fs paths, populate
session with virtualized file system (vfs) dict"""
        UserObj = User.get(identity.current.user.id)
        source_uri = UserObj.source_uri  #I added this column to the
User model
        albums_uri = UserObj.albums_uri #same with this column
        #log.debug(albums_uri), log.debug(source_uri)
        FS = FSHandler() #plug in the FSHandler class
        cherrypy.session['source_entries'] = FS.vfs(source_uri)
        cherrypy.session['albums_entries'] = FS.vfs(albums_uri)
        return dict()

In my app the user hits the index page once - never to return, so just
hitting the index controller when the user logs in instantiates the
session variables. Of course an app where the user returns to index a
lot you would want to check to see if the session's key was already
there and update it if it was instead of overwriting as this function
does. Sessions are a very powerful feature of turbogears and key to
making it work in a multiuser scenario.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to