[Zope-dev] Using propertysheets?
peter sabaini
sabaini@inode.at
Thu, 06 Jun 2002 22:50:17 +0200
Lennart Regebro wrote:
> I'm making a Zope product (in python) where I want the users to have control
> over what properties that exist. At the same time I don't want the users to
> have to deal with having all properties in one big mess under the standard
> Property-tab.
>
> So, my question is then: Should I use the PropertySheets class for this, and
> if yes, does anybody have any example code, becuase it's not immediately
> obvious how to use it.
I think it should work well with PropertyManager
Usage (works for me):
- Define your own edit form
- Derive your class from PropertyManager
- Add a propertysheet to a class instance, eg.:
def __init__(self):
self.propertysheets.manage_addPropertySheet('advanced', 'advanced')
- Add a prop:
advanced.manage_addProperty('something', 0, 'int')
- Do something with your propsheet, eg. update it:
adv = self.propertysheets.get('advanced')
if REQUEST is not None:
return self.manage_advancedForm(
REQUEST,
manage_tabs_message='Advanced Settings updated.',
)
- Or read a property:
self.propertysheets.get('advanced').something
If you're having problems just shout.
cheers!
peter.
> Best Regards
>
> Lennart Regebro
> Torped Strategi och Kommunikation AB
>
>
>
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope )
>
>