Re: [Zope-dev] Using propertysheets?
From: "peter sabaini" <[EMAIL PROTECTED]> > I think it should work well with PropertyManager Thanks, I got a lot further now. Still some things before I'm done though: > - Define your own edit form How do I do that? The default edit form /propertysheets/name/manage works well, but doesn't have any management tabs. I've done a lot of experimenting, but everytime I get management tabs I also get the default properties, no matter what view I'm on... Best Regards Lennart Regebro Torped Strategi och Kommunikation AB ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] Using propertysheets?
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 - [EMAIL PROTECTED] > 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 ) > > ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] Using PropertySheets
Thanks Steve Steve Alexander wrote: > > Erich Seifert wrote: > > > > > > * I can't pass a default value to a tokens property. How to? > > Can you pass in a space-separated string, such as '' or 'token1' or > 'token1 token2'? No I tried that. > > * I can't pass a default value to a boolean property. How to? > > How are you trying to do this? You can pass in the string '1' for true > and '0' for false. I tried both int numbers 0/1 and strings '0'/'1' > > Could someone please give me some example code or hints? > > It would really help to see some of the code you're already using. Can > you also say a bit about what you are trying to do overall? I'm currently trying to create a ZBibliography product. Every class should have a base class which defines the basic properties in two property sheets 'data' and description'. For example: the 'data' property sheet currently stores 'persons', and 'title' while the 'description' sheet stores for example 'languages' (tokens), 'offprint', and 'public' boolean attributes. I'm not shure if this works: I wanna extend the properties stored in the 'data' sheet in the subclasses 'book', 'article', etc. Please be patient because this is my first python program. I hope this helps Eric --- Here are parts of my code: Properties for the 'desc' PropertySheet self._descprops = ( {'id':'source', 'type':'string', 'value':'', 'mode':'w',}, {'id':'languages', 'type':'tokens', 'value':'en', 'mode':'w',}, {'id':'files', 'type':'lines', 'value':'', 'mode':'w',}, {'id':'keywords', 'type':'lines', 'value':'', 'mode':'w',}, {'id':'references', 'type':'lines', 'value':'', 'mode':'w',}, {'id':'abstracts', 'type':'text','value':'', 'mode':'w',}, {'id':'annotation', 'type':'text','value':'', 'mode':'w',}, {'id':'classification', 'mode':'w', 'type':'multiple selection', 'value':'', 'select_variable':'categories', 'mode':'w',}, {'id':'offprint', 'type':'boolean', 'value':0, 'mode':'w',}, {'id':'public', 'type':'boolean', 'value':1, 'mode':'w',}, ) Properties for the 'data' PropertySheet: self._dataprops = ( {'id':'persons', 'value':'','type':'lines', 'mode':'w'}, {'id':'title','value':title, 'type':'string', 'mode':'w'}, {'id':'title_transl', 'value':'','type':'string', 'mode':'w'}, ) ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] Using PropertySheets
Erich Seifert wrote: > > * I can't pass a default value to a tokens property. How to? Can you pass in a space-separated string, such as '' or 'token1' or 'token1 token2'? > * I can't pass a default value to a boolean property. How to? How are you trying to do this? You can pass in the string '1' for true and '0' for false. > Could someone please give me some example code or hints? It would really help to see some of the code you're already using. Can you also say a bit about what you are trying to do overall? -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )