[Zope-dev] Using PropertySheets

Erich Seifert e.seifert@gmx.net
Tue, 19 Sep 2000 13:09:45 +0200


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'},
)