本文整理汇总了Python中OFS.PropertyManager.PropertyManager类的典型用法代码示例。如果您正苦于以下问题:Python PropertyManager类的具体用法?Python PropertyManager怎么用?Python PropertyManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PropertyManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _updateProperty
def _updateProperty( self, id, value ):
if id == 'predicate':
self._setPredicate( value )
else:
PropertyManager._updateProperty( self, id, value )
示例2: _delProperty
def _delProperty(self, id):
""" Extends the PropertyManager method of the same name.
"""
PropertyManager._delProperty(self, id)
if self._property_mapping.has_key(id):
self._p_changed = 1
mp = self._property_mapping[id]
del(self._property_mapping[id])
示例3: getProperty
def getProperty(self, id, d=None):
"""Get property value and apply transformer. Overrides method in
Zope's PropertyManager class. Acquire values from aquisiton parents
if needed.
"""
ob = self._findParentWithProperty(id)
return d if (ob is None) else PropertyManager.getProperty(ob, id, d)
示例4: _updateProperty
def _updateProperty(self, id, value):
""" Hook for updating a particular property.
"""
self._p_changed = 1
# the check method should return the value to be stored or
# raise an Exception
check_method = getattr(self, 'check_%s' % id, None)
if check_method:
value = check_method(value)
# use the regular property sheets storage
PropertyManager._updateProperty(self, id, value)
# run a reindex if we are CatalogAware
if hasattr(self, 'reindex_object'):
self.reindex_object()
示例5: hasProperty
def hasProperty(self, id, useAcquisition=False):
"""Override method in PropertyManager to support acquisition.
"""
if useAcquisition:
hasProp = self._findParentWithProperty(id) is not None
else:
hasProp = PropertyManager.hasProperty(self, id)
return hasProp
示例6: manage_editProperties
def manage_editProperties(self,first_day_week,REQUEST=None):
""" Manage the edited values """
if first_day_week == 'Monday':
calendar.setfirstweekday(0)
else:
calendar.setfirstweekday(6)
self.ZCacheable_invalidate()
return PropertyManager.manage_editProperties(self,REQUEST)
示例7: getPropertyType
def getPropertyType(self, id):
"""
Overrides methods from PropertyManager to support acquistion.
"""
ob = self._findParentWithProperty(id)
if ob is None:
type = None
else:
type = PropertyManager.getPropertyType(ob, id)
return type
示例8: getZProperties
def getZProperties(context):
"""
Given a context, this function will return all of the ZProperties that
are defined for this context (ignoring acquisition)
@returns Dictionary of the form { 'zPropertyName' : 'zPropertyValue',}
"""
properties = {}
# make sure we actually have properties
if not isinstance(context, ZenPropertyManager):
return properties
for zprop in filter(iszprop, context.propertyIds()):
properties[zprop] = PropertyManager.getProperty(context, zprop)
return properties
示例9: afterSetUp
def afterSetUp(self):
self.props = PropertyManager()
# PropertyManager has title property already
self.props.manage_changeProperties(title = 'Player properties')
self.props.manage_addProperty('plugins/controls/url', '${portal_path}flowplayer.controls.swf', 'string')
self.props.manage_addProperty('plugins/controls/all', False, 'boolean')
self.props.manage_addProperty('plugins/controls/play', True, 'boolean')
self.props.manage_addProperty('plugins/controls/scrubber', True, 'boolean')
self.props.manage_addProperty('plugins/controls/tooltips/fullscreen', 'Enter fullscreen mode', 'string')
self.props.manage_addProperty('plugins/controls/tooltips/buttons', True, 'boolean')
self.props.manage_addProperty('plugins/audio/url', '${portal_url}++resource++collective.flowplayer/flowplayer.audio.swf', 'string')
self.props.manage_addProperty('clip/autoPlay',False, 'boolean')
self.props.manage_addProperty('clip/autoBuffering', True, 'boolean')
self.props.manage_addProperty('param/src', 'flowplayer.swf', 'string')
self.props.manage_addProperty('param/wmode', 'opaque', 'string')
示例10: manage_changeProperties
def manage_changeProperties(self, REQUEST=None, **kw):
result = PropertyManager.manage_changeProperties(self, REQUEST, **kw)
self.reindex_object()
return result
示例11: TestUtils
class TestUtils(ZopeTestCase.ZopeTestCase):
def afterSetUp(self):
self.props = PropertyManager()
# PropertyManager has title property already
self.props.manage_changeProperties(title = 'Player properties')
self.props.manage_addProperty('plugins/controls/url', '${portal_path}flowplayer.controls.swf', 'string')
self.props.manage_addProperty('plugins/controls/all', False, 'boolean')
self.props.manage_addProperty('plugins/controls/play', True, 'boolean')
self.props.manage_addProperty('plugins/controls/scrubber', True, 'boolean')
self.props.manage_addProperty('plugins/controls/tooltips/fullscreen', 'Enter fullscreen mode', 'string')
self.props.manage_addProperty('plugins/controls/tooltips/buttons', True, 'boolean')
self.props.manage_addProperty('plugins/audio/url', '${portal_url}++resource++collective.flowplayer/flowplayer.audio.swf', 'string')
self.props.manage_addProperty('clip/autoPlay',False, 'boolean')
self.props.manage_addProperty('clip/autoBuffering', True, 'boolean')
self.props.manage_addProperty('param/src', 'flowplayer.swf', 'string')
self.props.manage_addProperty('param/wmode', 'opaque', 'string')
def test_parsing(self):
parsed = properties_to_dict(self.props, 'http://localhost', ignore=['title'])
self.assertEqual(len(parsed.keys()), 2) # plugins, clip
self.assertEqual(len(parsed['plugins'].keys()), 2) # controls, audio
self.assertEqual(parsed['plugins']['controls']['all'], False)
self.assertEqual(parsed['plugins']['controls']['scrubber'], True)
self.assertEqual(parsed['plugins']['controls']['url'], r'http%3A//localhost/flowplayer.controls.swf')
self.assertEqual(parsed['plugins']['audio']['url'], r'http%3A//localhost/%2B%2Bresource%2B%2Bcollective.flowplayer/flowplayer.audio.swf')
self.assertEqual(parsed['clip']['autoBuffering'], True)
self.failIf(parsed.has_key('param'))
def test_parsing_flash_props(self):
parsed = flash_properties_to_dict(self.props, 'http://localhost')
self.assertEqual(len(parsed.keys()), 2) # src, wmode
self.assertEqual(parsed['src'], 'flowplayer.swf')
self.assertEqual(parsed['wmode'], 'opaque')
示例12: manage_changeProperties
def manage_changeProperties(self, **kwargs):
"""Ensure the SQL methods get regenerated."""
self.delSQLQueries()
PropertyManager.manage_changeProperties(self, **kwargs)
self.addSQLQueries()
示例13: setUp
def setUp(self):
from OFS.PropertyManager import PropertyManager
obj = PropertyManager('obj')
obj.foobarbaz = ('Foo', 'Bar', 'Baz')
obj._properties = ()
obj.manage_addProperty('foo_boolean', '', 'boolean')
obj.manage_addProperty('foo_date', '1970/01/01', 'date')
obj.manage_addProperty('foo_float', '0', 'float')
obj.manage_addProperty('foo_int', '0', 'int')
obj.manage_addProperty('foo_lines', '', 'lines')
obj.manage_addProperty('foo_long', '0', 'long')
obj.manage_addProperty('foo_string', '', 'string')
obj.manage_addProperty('foo_text', '', 'text')
obj.manage_addProperty('foo_tokens', '', 'tokens')
obj.manage_addProperty('foo_selection', 'foobarbaz', 'selection')
obj.manage_addProperty('foo_mselection', 'foobarbaz',
'multiple selection')
obj.manage_addProperty('foo_boolean0', '', 'boolean')
obj.manage_addProperty('foo_ro', '', 'string')
obj._properties[-1]['mode'] = '' # Read-only, not exported or purged
obj.manage_addProperty('foo_int_nodel', 0, 'int')
obj._properties[-1]['mode'] = 'w' # Not deletable
obj.manage_addProperty('foo_float_nodel', 0, 'float')
obj._properties[-1]['mode'] = 'w' # Not deletable
obj.manage_addProperty('foo_boolean_nodel', '', 'boolean')
obj._properties[-1]['mode'] = 'w' # Not deletable
self.helpers = self._makeOne(obj, DummySetupEnviron())
示例14: manage_editProperties
def manage_editProperties(self, REQUEST):
"""Change properties from ZMI"""
result = PropertyManager.manage_editProperties(self, REQUEST)
self.reindex_object()
return result
示例15: _setPropValue
def _setPropValue(self, id, value):
PropertyManager._setPropValue(self, id, value)
self.ZCacheable_invalidate()