I have a python script that I'd like to get a property from a page template. What would the code look like to do that? I've tried context['page.html'].properties['redirect'], context['page.html'].properties.getProperty('redirect'), and can't find anything in the docs that indicate how to do something like that... Or, even better this is what I want to do -> When someone goes to a members only page, check if they're logged in, if so display the page, otherwise redirect them to the login form. After they login, I want to redirect them back to the page they originally wanted. I'm NOT using the CMF, so I have to do logins, auth, and all that jazz myself. -jim
Jim Kutter writes:
I have a python script that I'd like to get a property from a page template.
What would the code look like to do that?
I've tried context['page.html'].properties['redirect'], context['page.html'].properties.getProperty('redirect'), and can't find anything in the docs that indicate how to do something like that... Currently all Zope objects map their properties as attributes of the object itself. This means, you access property "p" of object "o" by "o.p".
When you want to change properties, it depends whether or not they belong to a Property Sheet. This usually is the case for ZClasses. For ZClasses, you can change them through: o.propertysheets.your_property_sheet.manage_changeProperties(...) When the properties do not belong to a propertysheet, you simple use o.manage_changeProperties(...) Dieter
participants (2)
-
Dieter Maurer -
Jim Kutter