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

# Class PropertyDescriptor

source code

    object --+
             |
            PropertyDescriptor

Transforms the property value based on its type.

Follows the Descriptor protocol defined at http://docs.python.org/reference/datamodel.html#descriptors

Instance Methods | [hide private]
__init__(self, id, type, transformer) | source code
__get__(self, instance, owner) Returns self for class attribute access. | source code
__set__(self, instance, value) Transforms the value and sets it. | source code
__delete__(self, instance) Delete the property. | source code
_migrate(self, instance) If the id is in __dict__ then move the value to the _propertyValues dictionary. | source code
_set(self, instance, value) Transform and set the value in the _propertyValues dictionary. | source code
_transform(self, instance, value, method) Lookup the transformer for the type and transform the value. | source code

Method Details | [hide private]

### __init__(self, id, type, transformer) (Constructor) | source code
Overrides: object.__init__ (inherited documentation)

### __get__(self, instance, owner) | source code
Returns self for class attribute access. Returns the transformed value for instance attribute access.

### _migrate(self, instance) | source code
If the id is in __dict__ then move the value to the _propertyValues dictionary. Check to make sure that the type of this descriptor class and the type in the Zope OFS PropertyManager metadata are the same.

### _transform(self, instance, value, method) | source code
Lookup the transformer for the type and transform the value. The method parameter can be 'transformForGet' or 'transformForSet' and determines the transformer method that is called.