本文整理汇总了Python中OFS.SimpleItem.SimpleItem类的典型用法代码示例。如果您正苦于以下问题:Python SimpleItem类的具体用法?Python SimpleItem怎么用?Python SimpleItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimpleItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_workflow
def _setup_workflow(self):
args = {'id': 'collection',
'title': 'mock_collection',
'year': '2011',
'endyear': '2012',
'partofyear': 'wholeyear',
'country': 'http://rod.eionet.eu.int/spatial/2',
'locality': '',
'descr': '',
'dataflow_uris': ['http://rod.eionet.eu.int/obligations/8'],
'dataflow_uris': [],
'allow_collections': True,
'allow_envelopes': True}
col = Collection(**args)
self.app._setObject('collection', col)
self.app._setObject('Templates', Folder('Templates'))
template = SimpleItem()
template.id = 'StartActivity'
template.__call__ = Mock(return_value='Envelope Test Template')
self.app.Templates._setOb('StartActivity', template)
self.app.Templates.StartActivity.title_or_id = Mock(return_value='Start Activity Template')
self.create_process(self, 'process')
self.wf.addApplication('StartActivity', 'Templates/StartActivity')
self.wf.process.addActivity('AutoBegin',
split_mode='xor',
join_mode='xor',
start_mode=1,
application='StartActivity')
self.wf.process.begin = 'AutoBegin'
self.wf.setProcessMappings('process', '1', '1')
示例2: persistent_load
def persistent_load(ref):
assert ref == 'ignored'
# Return a placeholder object that will be replaced by
# removeNonVersionedData().
placeholder = SimpleItem()
placeholder.id = "ignored_subobject"
return placeholder
示例3: manage_beforeDelete
def manage_beforeDelete(self, item, container):
"""
This method is called, when the object is deleted.
"""
SimpleItem.inheritedAttribute('manage_beforeDelete')(self, item, container)
try: self.getPortletsTool()._delObject(ID_REFLIST)
except: pass
示例4: manage_afterAdd
def manage_afterAdd(self, item, container):
""" manage the add """
SimpleItem.inheritedAttribute('manage_afterAdd')(self, item, container)
item.load_roles_list()
item.load_languages_list()
item.load_stop_words_list()
item.load_subjects_list()
示例5: testBoboTraverseTraversalDefault
def testBoboTraverseTraversalDefault(self):
from OFS.SimpleItem import SimpleItem
from ZPublisher.interfaces import UseTraversalDefault
class BoboTraversableUseTraversalDefault(SimpleItem):
"""
A BoboTraversable class which may use "UseTraversalDefault"
(dependent on "name") to indicate that standard traversal should
be used.
"""
default = 'Default'
def __bobo_traverse__(self, request, name):
if name == 'normal':
return 'Normal'
raise UseTraversalDefault
bb = BoboTraversableUseTraversalDefault()
# normal access -- no traversal default used
self.assertEqual(bb.unrestrictedTraverse('normal'), 'Normal')
# use traversal default
self.assertEqual(bb.unrestrictedTraverse('default'), 'Default')
# test traversal default with acqires attribute
si = SimpleItem()
si.default_acquire = 'Default_Acquire'
si.bb = bb
self.assertEqual(si.unrestrictedTraverse('bb/default_acquire'),
'Default_Acquire')
示例6: test_standard_error_message_is_called
def test_standard_error_message_is_called(self):
from zExceptions import BadRequest
from OFS.SimpleItem import SimpleItem
# handle_errors should default to True. It is a flag used for
# functional doctests. See ZPublisher/Test.py and
# ZPublisher/Publish.py.
class REQUEST(object):
class RESPONSE(object):
handle_errors = True
class StandardErrorMessage(object):
def __init__(self):
self.kw = {}
def __call__(self, **kw):
self.kw.clear()
self.kw.update(kw)
item = SimpleItem()
item.standard_error_message = sem = StandardErrorMessage()
try:
raise BadRequest("1")
except:
item.raise_standardErrorMessage(client=item,
REQUEST=REQUEST())
self.assertEquals(sem.kw.get('error_type'), 'BadRequest')
示例7: manage_beforeDelete
def manage_beforeDelete(self, item, container):
""" """
#delete objects dynamic properties
l_ids = self.getDynamicPropertiesIds()
for l_object in self.getCatalogedObjects(self.id):
map(l_object.deleteProperty, l_ids)
SimpleItem.inheritedAttribute('manage_beforeDelete')(self, item, container)
示例8: manage_beforeDelete
def manage_beforeDelete(self, item, container):
""" this method is called, when the object is deleted """
if self.meta_type == EEA_GLOSSARY_ELEMENT_METATYPE:
self.utSynonymElDel()
else:
self.utElementSynDel()
SimpleItem.inheritedAttribute('manage_beforeDelete')(self, item, container)
self.cu_uncatalog_object(self)
示例9: manage_beforeDelete
def manage_beforeDelete(self, item, container):
SimpleItem.manage_beforeDelete(self, item, container)
if self is item:
# unregister self from catalog on deletion
# While building business template, transform tool will be
# copied and this transform will be removed from copied one
# so that this must not use getToolByName to retrive the tool.
tr_tool = self.aq_parent
tr_tool._unmapTransform(self)
示例10: __init__
def __init__(self, id, max_age, number_to_keep, pub_path):
SimpleItem.inheritedAttribute('__init__')(self, id, '[VersionCleanUp Helper object]')
self.id = id
self._description = self.__doc__
self._max_age = self._number_to_keep = self._removed = 0
self._pub_path = pub_path
self.set_max_age(max_age)
self.set_number_to_keep(number_to_keep)
self.set_pub_path(pub_path)
示例11: __setstate__
def __setstate__(self, *args, **kwargs):
"""
When an instance of SAWrapper is unpickled, perform the normal
'wakeup', but also ensure that the instance is in the module
registry of instances.
"""
# Don't use 'super' when old-style classes are involved.
SimpleItem.__setstate__(self, *args, **kwargs)
register_sa_wrapper(self.id, self._wrapper)
示例12: manage_afterAdd
def manage_afterAdd(self, item, container):
""" """
#create objects dynamic properties
l_dp_dict = {}
lang = self.gl_get_selected_language()
for dp in self.getDynamicProperties():
l_dp_dict[dp.id] = dp.defaultvalue
for l_object in self.getCatalogedObjects(self.id):
l_object.createDynamicProperties(l_dp_dict, lang)
SimpleItem.inheritedAttribute('manage_afterAdd')(self, item, container)
示例13: _makeOne
def _makeOne(self, id='date'):
index = self._getTargetClass()(id)
class DummyZCatalog(SimpleItem):
id = 'DummyZCatalog'
# Build pseudo catalog and REQUEST environment
catalog = makerequest(DummyZCatalog())
indexes = SimpleItem()
indexes = indexes.__of__(catalog)
index = index.__of__(indexes)
return index
示例14: __init__
def __init__(self, context, request, previous=[]):
SimpleItem.__init__(self, context, request)
self.previous = previous
self.__name__ = 'dvpdffiles'
self.site = _getPortal(request, context)
self.global_settings = GlobalSettings(self.site)
self.storage_type = self.global_settings.storage_type
self.__dir = Directory(
os.path.join(self.global_settings.storage_location, *previous),
self.__name__)
DirectoryResource.__init__(self, self.__dir, request)
示例15: manage_afterAdd
def manage_afterAdd(self, item, container):
""" Ensure that a new utility id is assigned after creating
or copying an instance.
"""
self._new_utilid()
register_sa_wrapper(self.id, self._wrapper)
return SimpleItem.manage_afterAdd(self, item, container)