Class ATToolDependentFieldProperty
source code
object --+
|
ATFieldProperty --+
|
ATToolDependentFieldProperty
A version of the field property type which is able to acquire tools.
This uses a not-very-nice acquisition hack, and is not generalisable to
all acquisition-dependent operations, but should work for tools in the
portal root.
>>> from Products.Archetypes.atapi import *
>>> from iccommunity.core.fieldproperty import ATToolDependentFieldProperty
>>> from zope.app.component.hooks import setSite
>>> setSite(portal)
>>> class MyContent(BaseContent):
... portal_type = meta_type = 'MyContent'
... schema = Schema((
... ReferenceField('some_field', multiValued=True,
... relationship='foo', storage=AnnotationStorage()),
... ))
...
... some_field = ATToolDependentFieldProperty('some_field')
>>> registerType(MyContent, 'Archetypes')
>>> self.portal._setOb('foo', MyContent('foo'))
>>> foo = getattr(self.portal, 'foo')
These lines would fail with AttributeError: reference_catalog if it
used the standard accessor.
>>> foo.some_field
[]
>>> foo.some_field = [self.folder.UID()]
>>> foo.some_field
[<ATFolder at /plone/Members/test_user_1_>]
|
__init__(self,
name,
get_transform=None,
set_transform=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature |
source code
|
|
|
|
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__str__
|
Inherited from object :
__class__
|
__init__(self,
name,
get_transform=None,
set_transform=None)
(Constructor)
| source code
|
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
- Overrides:
object.__init__
- (inherited documentation)
|