Package OFS :: Module PropertyManager :: Class PropertyManager
[show private | hide private]
[frames | no frames]

Type PropertyManager

           object --+    
                    |    
                 Base --+
                        |
         Node --+       |
                |       |
          Element --+   |
                    |   |
ElementWithAttributes --+
                        |
                       PropertyManager

Known Subclasses:
ClassifierEntry, ConfmonPropManager, Device, Folder, ZenPropertyManager, ZenPropertyManager, ZenTableManager, ZopePageTemplate

The PropertyManager mixin class provides an object with transparent property management. An object which wants to have properties should inherit from PropertyManager.

An object may specify that it has one or more predefined properties, by specifying an _properties structure in its class:
 _properties=({'id':'title', 'type': 'string', 'mode': 'w'},
              {'id':'color', 'type': 'string', 'mode': 'w'},
              )

The _properties structure is a sequence of dictionaries, where each dictionary represents a predefined property. Note that if a predefined property is defined in the _properties structure, you must provide an attribute with that name in your class or instance that contains the default value of the predefined property.

Each entry in the _properties structure must have at least an 'id' and a 'type' key. The 'id' key contains the name of the property, and the 'type' key contains a string representing the object's type. The 'type' string must be one of the values: 'float', 'int', 'long', 'string', 'lines', 'text', 'date', 'tokens', 'selection', or 'multiple section'.

For 'selection' and 'multiple selection' properties, there is an addition item in the property dictionay, 'select_variable' which provides the name of a property or method which returns a list of strings from which the selection(s) can be chosen.

Each entry in the _properties structure may *optionally* provide a 'mode' key, which specifies the mutability of the property. The 'mode' string, if present, must contain 0 or more characters from the set 'w','d'.

A 'w' present in the mode string indicates that the value of the property may be changed by the user. A 'd' indicates that the user can delete the property. An empty mode string indicates that the property and its value may be shown in property listings, but that it is read-only and may not be deleted.

Entries in the _properties structure which do not have a 'mode' key are assumed to have the mode 'wd' (writeable and deleteable).

To fully support property management, including the system-provided tabs and user interfaces for working with properties, an object which inherits from PropertyManager should include the following entry in its manage_options structure:
 {'label':'Properties', 'action':'manage_propertiesForm',}
to ensure that a 'Properties' tab is displayed in its management interface. Objects that inherit from PropertyManager should also include the following entry in its __ac_permissions__ structure:
 ('Manage properties', ('manage_addProperty',
                        'manage_editProperties',
                        'manage_delProperties',
                        'manage_changeProperties',)),

Method Summary
  getProperty(self, id, d)
Get the property 'id'.
  getPropertyType(self, id)
Get the type of property 'id'.
  hasProperty(self, id)
Return true if object has a property 'id'.
  manage_addProperty(self, id, value, type, REQUEST)
Add a new property via the web.
  manage_changeProperties(self, REQUEST, **kw)
Change existing object properties.
  manage_changePropertyTypes(self, old_ids, props, REQUEST)
Replace one set of properties with another
  manage_delProperties(self, ids, REQUEST)
Delete one or more properties specified by 'ids'.
  manage_editProperties(self, REQUEST)
Edit object properties via the web.
  propdict(self)
  propertyIds(self)
Return a list of property ids.
  propertyItems(self)
Return a list of (id,property) tuples.
  propertyLabel(self, id)
Return a label for the given property id
  propertyMap(self)
Return a tuple of mappings, giving meta-data for properties.
  propertyValues(self)
Return a list of actual property objects.
  valid_property_id(self, id)
  _delProperty(self, id)
  _delPropValue(self, id)
  _propertyMap(self)
Return a tuple of mappings, giving meta-data for properties.
  _setProperty(self, id, value, type)
  _setPropValue(self, id, value)
  _updateProperty(self, id, value)
  _wrapperCheck(self, object)
Inherited from ElementWithAttributes: getAttribute, getAttributeNode, getAttributes
Inherited from Element: getChildNodes, getElementsByTagName, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getParentNode, getPreviousSibling, getTagName
Inherited from Node: getNodeValue, getOwnerDocument, hasChildNodes
Inherited from Base: __getattribute__, __getnewargs__, __getstate__, __new__, __reduce__, __setstate__
Inherited from object: __init__, __delattr__, __hash__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variable Summary
tuple __ac_permissions__ = (('Manage properties', ('manage_add...
Implements __implemented__ = <implementedBy OFS.PropertyManager.Pro...
tuple __propsets__ = ()
ClassProvides __provides__ = <zope.interface.declarations.ClassProvide...
PermissionRole __roles__ = <PermissionRole object at 0xf260>
PermissionRole getProperty__roles__ = <PermissionRole object at 0xf260>
PermissionRole getPropertyType__roles__ = <PermissionRole object at 0xf...
PermissionRole hasProperty__roles__ = <PermissionRole object at 0xf260>
PermissionRole manage_addProperty__roles__ = <PermissionRole object at ...
PermissionRole manage_changeProperties__roles__ = <PermissionRole objec...
PermissionRole manage_changePropertyTypes__roles__ = <PermissionRole ob...
PermissionRole manage_delProperties__roles__ = <PermissionRole object a...
PermissionRole manage_editProperties__roles__ = <PermissionRole object ...
tuple manage_options = ({'action': 'manage_propertiesForm', 'h...
DTMLFile manage_propertiesForm = <App.special_dtml.DTMLFile objec...
PermissionRole manage_propertiesForm__roles__ = <PermissionRole object ...
DTMLFile manage_propertyTypeForm = <App.special_dtml.DTMLFile obj...
PermissionRole manage_propertyTypeForm__roles__ = <PermissionRole objec...
PermissionRole propdict__roles__ = <PermissionRole object at 0xf260>
PermissionRole propertyIds__roles__ = <PermissionRole object at 0xf260>
PermissionRole propertyItems__roles__ = <PermissionRole object at 0xf26...
PermissionRole propertyLabel__roles__ = <PermissionRole object at 0xf26...
PermissionRole propertyMap__roles__ = <PermissionRole object at 0xf260>
vps propertysheets = <OFS.PropertySheets.vps object at 0x14a...
PermissionRole propertyValues__roles__ = <PermissionRole object at 0xf2...
str title = ''
PermissionRole valid_property_id__roles__ = <PermissionRole object at 0...
tuple _properties = ({'type': 'string', 'id': 'title', 'mode':...
tuple _reserved_names = ()
Inherited from Node: __providedBy__

Method Details

getProperty(self, id, d=None)

Get the property 'id'.

Returns the optional second argument or None if no such property is found.

getPropertyType(self, id)

Get the type of property 'id'.

Returns None if no such property exists.

hasProperty(self, id)

Return true if object has a property 'id'.

manage_addProperty(self, id, value, type, REQUEST=None)

Add a new property via the web.

Sets a new property with the given id, type, and value.

manage_changeProperties(self, REQUEST=None, **kw)

Change existing object properties.

Change object properties by passing either a mapping object of name:value pairs {'foo':6} or passing name=value parameters

manage_changePropertyTypes(self, old_ids, props, REQUEST=None)

Replace one set of properties with another

Delete all properties that have ids in old_ids, then add a property for each item in props. Each item has a new_id, new_value, and new_type. The type of new_value should match new_type.

manage_delProperties(self, ids=None, REQUEST=None)

Delete one or more properties specified by 'ids'.

manage_editProperties(self, REQUEST)

Edit object properties via the web.

The purpose of this method is to change all property values, even those not listed in REQUEST; otherwise checkboxes that get turned off will be ignored. Use manage_changeProperties() instead for most situations.

propertyIds(self)

Return a list of property ids.

propertyItems(self)

Return a list of (id,property) tuples.

propertyLabel(self, id)

Return a label for the given property id

propertyMap(self)

Return a tuple of mappings, giving meta-data for properties.

Return copies of the real definitions for security.

propertyValues(self)

Return a list of actual property objects.

_propertyMap(self)

Return a tuple of mappings, giving meta-data for properties.

Class Variable Details

__ac_permissions__

Type:
tuple
Value:
(('Manage properties',
  ('manage_addProperty',
   'manage_editProperties',
   'manage_delProperties',
   'manage_changeProperties',
   'manage_propertiesForm',
   'manage_propertyTypeForm',
   'manage_changePropertyTypes')),
...                                                                    

__implemented__

Type:
Implements
Value:
<implementedBy OFS.PropertyManager.PropertyManager>                    

__propsets__

Type:
tuple
Value:
()                                                                     

__provides__

Type:
ClassProvides
Value:
<zope.interface.declarations.ClassProvides object at 0x1590250>        

__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf260>                                      

getProperty__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf260>                                      

getPropertyType__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf260>                                      

hasProperty__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf260>                                      

manage_addProperty__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf608>                                      

manage_changeProperties__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf608>                                      

manage_changePropertyTypes__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf608>                                      

manage_delProperties__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf608>                                      

manage_editProperties__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf608>                                      

manage_options

Type:
tuple
Value:
({'action': 'manage_propertiesForm',
  'help': ('OFSP', 'Properties.stx'),
  'label': 'Properties'},)                                             

manage_propertiesForm

Type:
DTMLFile
Value:
<App.special_dtml.DTMLFile object at 0x14a8b10>                        

manage_propertiesForm__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf608>                                      

manage_propertyTypeForm

Type:
DTMLFile
Value:
<App.special_dtml.DTMLFile object at 0x14a8cb0>                        

manage_propertyTypeForm__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf608>                                      

propdict__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf260>                                      

propertyIds__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf260>                                      

propertyItems__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf260>                                      

propertyLabel__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf260>                                      

propertyMap__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf260>                                      

propertysheets

Type:
vps
Value:
<OFS.PropertySheets.vps object at 0x14a8c70>                           

propertyValues__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf260>                                      

title

Type:
str
Value:
''                                                                     

valid_property_id__roles__

Type:
PermissionRole
Value:
<PermissionRole object at 0xf260>                                      

_properties

Type:
tuple
Value:
({'type': 'string', 'id': 'title', 'mode': 'wd'},)                     

_reserved_names

Type:
tuple
Value:
()                                                                     

Generated by Epydoc 2.1 on Thu Aug 16 09:55:12 2007 http://epydoc.sf.net