On 5/10/07, John_Nowlan <[EMAIL PROTECTED]> wrote: > This is on my todo list and its been rolling around my head for awhile. I > assume it is a common use case but I can't find where to get started. > > Most of our users have one or more of a small set of roles. In the legacy > system, they login, are authenticated against a db, and a session cookie is > set. Roles are checked before pages are generated. > > The menu pages that are displayed are the same for each role. What I'd like > to do is cache these menu pages and not have to check the db and regenerate > each time. > > My extremely rough sketch pseudocode: > > On Login: > Create session object > select roles for user from db > for each role add to session (dictionary?) > > On page request > if user has role for requested page > if cached page exists > display cached page > > if page is a menu page > cache page > > I understand the users, roles, db and cookies side of it but it is the > mechanics of having 'pages cached by group not individual session' in > myghty or mako and pylons/python that is throwing me a little. If anyone can > shed a little light as to the specifics of implementation or give pointers > I'd appreciate it. > > I think I want to use authkit and beaker but how? > > It also strikes me that this is probably a great place to be taking > advantage of sqlalchemy's orm features but again how? I've just used > sqlalchemy with explicit sql so far, but here is somewhere where the cost of > learning how to use the orm features might be worth the cost.
Have you had a look at: http://pylonshq.com/docs/0.9.5/caching.html In the "cache object" section, it also references: http://www.myghty.org/docs/cache.myt#caching_interface The trick is that you want to use the user's group as the cache key. As for the SQLAlchemy ORM, all I can say is that it's useful. I found that reading the tutorial: http://www.sqlalchemy.org/docs/tutorial.html was enough for me to get started. Best Regards, -jj -- http://jjinux.blogspot.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" 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/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
