exUserFolder + MySQL + Python syntax problem
I am having trouble accessing the API functions in exUserFolder. I am using exUserFolder because I need to merge user data and properties with a MySQL database table. I have taken the approach of making one "account" table that has many properties of a user (first_name, last_name, title, office_telephone....). I did this because some of this data will be maintained by an application outside of ZOPE and the single record approach works best for that configuration. What I want to do is, at login time, load various fields from that "account" table into temporary properties that I can access throughout the site. To do this, I built a LoadProperties Python script that looks like this: ================================================= MyUsername = context.REQUEST.AUTHENTICATED_USER context.REQUEST.AUTHENTICATED_USER.flushTempProperties for user in container.ListUsers(username=MyUsername): context.REQUEST.AUTHENTICATED_USER.setTempProperty('account_id' , user.account_id ) context.REQUEST.AUTHENTICATED_USER.setTempProperty('username' , user.username ) context.REQUEST.AUTHENTICATED_USER.setTempProperty('user_type' , user.user_type ) return =================================================== and it calls a ZSQL Method called "ListUsers" to retrieve the current user. I've tested that and it works. What I can't seem to get working is the ".flushTempProperties" and ".setTempProperty" calls. I call ".flushTempProperties" because I want to clear all temporary properties before I load new values from the "account" table. The syntax <dtml-var "AUTHENTICATED_USER.getProperty('full_name', '')> worked in a DTML document to retrieve a properties which I placed into the "account" table where user info is stored. Can someone suggest the correct syntax to access the ".flushTempProperties" and ".setTempProperty" functions inside my Python Module? Thank you for you time, David ======================================= David T. Washburn DWashburn@AmInfo.com Amherst, MA USA 413 256-3103
participants (1)
-
David Washburn