Package Products :: Package ZenRelations :: Module ZenPropertyManager :: Class ZenPropertyManager
[hide private]
[frames] | no frames]

Class ZenPropertyManager

source code

                             object --+
                                      |
            ExtensionClass.Base --+   |
                                  |   |
          OFS.ZDOM.Node --+       |   |
                          |       |   |
           OFS.ZDOM.Element --+   |   |
                              |   |   |
 OFS.ZDOM.ElementWithAttributes --+   |
                                  |   |
OFS.PropertyManager.PropertyManager --+
                                      |
                                     ZenPropertyManager


ZenPropertyManager adds keyedselection type to PropertyManager.
A keyedselection displayes a different name in the popup then
the actual value the popup will have.

It also has management for zenProperties which are properties that can be
inherited long the acquision chain.  All properties are for a branch are
defined on a "root node" specified by the function which must be returned
by the function getZenRootNode that should be over ridden in a sub class.
Prperties can then be added further "down" the aq_chain by calling 
setZenProperty on any contained node.

ZenProperties all have the same prefix which is defined by iszprop
this can be overridden in a subclass.

ZenPropertyManager overrides getProperty and getPropertyType from 
PropertyManager to support acquisition. If you want to query an object
about a property, but do not want it to search the acquistion chain then
use the super classes method or aq_base.  Example:
    
    # acquires property from dmd.Devices
    dmd.Devices.Server.getProperty('zCollectorPlugins')
    
    # does not acquire property from dmd.Devices
    PropertyManager.getProperty(dmd.Devices.Server, 'zCollectorPlugins')
    
    # also does not acquire property from dmd.Devices
    aq_base(dmd.Devices.Server).getProperty('zSnmpCommunity')
    
The properties are stored as attributes which is convenient, but can be 
confusing.  Attribute access always uses acquistion.  Setting an
attribute, will not add it to the list of properties, so subsquent calls
to hasProperty or getProperty won't return it.

Property Transformers are stored at dmd.propertyTransformers and transform
the property based on type during calls to the _setProperty, 
_updateProperty, and getProperty methods. Adding a property using 
_setProperty applies the appropriate transformer and adds its value as an
attribute, but when you access it as an attribute the property transformer
is again applied, but this time using its transformForGet method.



Instance Methods [hide private]
 
_setPropValue(self, id, value)
override from PerpertyManager to handle checks and ip creation
source code
 
_setProperty(self, id, value, type='string', label=None, visible=True, setter=None)
for selection and multiple selection properties the value argument indicates the select variable of the property
source code
 
_updateProperty(self, id, value)
This method sets a property on a zope object.
source code
 
manage_editProperties(self, REQUEST)
Edit object properties via the web.
source code
 
getZenRootNode(self)
sub class must implement to use zenProperties.
source code
 
zenPropertyIds(self, all=True, pfilt=iszprop)
Return list of device tree property names.
source code
 
zenPropertyItems(self)
Return list of (id, value) tuples of zenProperties.
source code
 
zenPropertyMap(self, pfilt=iszprop)
Return property mapping of device tree properties.
source code
 
zenPropertyString(self, id)
Return the value of a device tree property as a string
source code
 
zenPropIsPassword(self, id)
Is this field a password field.
source code
 
zenPropertyPath(self, id)
Return the primaryId of where a device tree property is found.
source code
 
setZenProperty(self, propname, propvalue, REQUEST=None)
Add or set the propvalue of the property propname on this node of the device Class tree.
source code
 
saveZenProperties(self, pfilt=iszprop, REQUEST=None)
Save all ZenProperties found in the REQUEST.form object.
source code
 
deleteZenProperty(self, propname=None, REQUEST=None)
Delete device tree properties from the this DeviceClass object.
source code
 
zenPropertyOptions(self, propname)
Provide a set of default options for a ZProperty
source code
 
isLocal(self, propname)
Check to see if a name is local to our current context.
source code
 
getOverriddenObjects(self, propname, showDevices=False)
Get the objects that override a property somewhere below in the tree
source code
 
_findParentWithProperty(self, id)
Returns self or the first acquisition parent that has a property with the id.
source code
 
hasProperty(self, id, useAcquisition=False)
Override method in PropertyManager to support acquisition.
source code
 
getProperty(self, id, d=None)
Get property value and apply transformer.
source code
 
getPropertyType(self, id)
Overrides methods from PropertyManager to support acquistion.
source code
 
getZ(self, id)
Return the value of a zProperty on this object.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Inherited from OFS.PropertyManager.PropertyManager: manage_addProperty, manage_changeProperties, manage_changePropertyTypes, manage_delProperties, propdict, propertyDescription, propertyIds, propertyItems, propertyLabel, propertyMap, propertyValues, valid_property_id

Inherited from OFS.PropertyManager.PropertyManager (private): _delPropValue, _delProperty, _propertyMap, _wrapperCheck

Inherited from OFS.ZDOM.ElementWithAttributes: getAttribute, getAttributeNode, getAttributes

Inherited from OFS.ZDOM.Element: getChildNodes, getElementsByTagName, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getParentNode, getPreviousSibling, getTagName

Inherited from OFS.ZDOM.Node: getNodeValue, getOwnerDocument, hasChildNodes

Class Variables [hide private]
  __pychecker__ = 'no-override'
  security = ClassSecurityInfo()
  manage_propertiesForm = DTMLFile('dtml/properties', globals(),...
  _onlystars = re.compile("^\*+$").search

Inherited from OFS.PropertyManager.PropertyManager: __propsets__, manage_options, manage_propertyTypeForm, propertysheets, title

Inherited from OFS.PropertyManager.PropertyManager (private): _properties, _reserved_names

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_setPropValue(self, id, value)

source code 
override from PerpertyManager to handle checks and ip creation
Overrides: OFS.PropertyManager.PropertyManager._setPropValue

_setProperty(self, id, value, type='string', label=None, visible=True, setter=None)

source code 
for selection and multiple selection properties the value argument indicates the select variable of the property
Overrides: OFS.PropertyManager.PropertyManager._setProperty

_updateProperty(self, id, value)

source code 
This method sets a property on a zope object. It overrides the method in PropertyManager. If Zope is upgraded you will need to check that this method has not changed! It is overridden so that we can catch the ValueError returned from the field2* converters in the class Converters.py
Overrides: OFS.PropertyManager.PropertyManager._updateProperty

manage_editProperties(self, REQUEST)

source code 
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.
Overrides: OFS.PropertyManager.PropertyManager.manage_editProperties

zenPropertyIds(self, all=True, pfilt=iszprop)

source code 
Return list of device tree property names. If all use list from property root node.

_findParentWithProperty(self, id)

source code 
Returns self or the first acquisition parent that has a property with the id. Returns None if no parent had the id.

hasProperty(self, id, useAcquisition=False)

source code 
Override method in PropertyManager to support acquisition.
Overrides: OFS.PropertyManager.PropertyManager.hasProperty

getProperty(self, id, d=None)

source code 
Get property value and apply transformer. Overrides method in Zope's PropertyManager class. Acquire values from aquisiton parents if needed.
Overrides: OFS.PropertyManager.PropertyManager.getProperty

getPropertyType(self, id)

source code 
Overrides methods from PropertyManager to support acquistion.
Overrides: OFS.PropertyManager.PropertyManager.getPropertyType

getZ(self, id)

source code 
Return the value of a zProperty on this object. This method is used to lookup zProperties for a user with a role that doesn't have direct access to an attribute further up the acquisition path. If the requested property is a password, then None is returned.
Parameters:
  • id (string) - id of zProperty
Returns:
Value of zProperty

Permission: ZEN_ZPROPERTIES_VIEW

>>> dmd.Devices.getZ('zSnmpPort')
161
>>> dmd.Devices.getZ('zWinPassword')
>>>


Class Variable Details [hide private]

manage_propertiesForm

Value:
DTMLFile('dtml/properties', globals(), property_extensible_schema__= 1\
)