当前位置: 首页>>代码示例>>Python>>正文


Python SimpleItem.SimpleItem类代码示例

本文整理汇总了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')
开发者ID:eea,项目名称:Products.Reportek,代码行数:31,代码来源:common.py

示例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
开发者ID:jean,项目名称:Products.ZopeVersionControl,代码行数:7,代码来源:Version.py

示例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
开发者ID:eaudeweb,项目名称:naaya,代码行数:7,代码来源:NyEurope.py

示例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()
开发者ID:eea,项目名称:EEAGlossary,代码行数:7,代码来源:EEAGlossaryEngine.py

示例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')
开发者ID:zopefoundation,项目名称:Zope,代码行数:28,代码来源:testTraverse.py

示例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')
开发者ID:Andyvs,项目名称:TrackMonthlyExpenses,代码行数:29,代码来源:testSimpleItem.py

示例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)
开发者ID:eaudeweb,项目名称:naaya,代码行数:7,代码来源:DynamicPropertiesItem.py

示例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)
开发者ID:eea,项目名称:EEAGlossary,代码行数:8,代码来源:EEAGlossaryElement.py

示例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)
开发者ID:Provab-Solutions,项目名称:erp5,代码行数:9,代码来源:Transform.py

示例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)
开发者ID:webbyfox,项目名称:SilvaVersionCleanUp,代码行数:9,代码来源:VersionCleanUp.py

示例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)
开发者ID:sheilatron,项目名称:Products.SQLAlchemyDA,代码行数:9,代码来源:da.py

示例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)
开发者ID:eaudeweb,项目名称:naaya,代码行数:10,代码来源:DynamicPropertiesItem.py

示例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
开发者ID:eprigorodov,项目名称:Products.ZCatalog,代码行数:13,代码来源:tests.py

示例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)
开发者ID:adam139,项目名称:devplone422,代码行数:13,代码来源:views.py

示例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)
开发者ID:sheilatron,项目名称:Products.SQLAlchemyDA,代码行数:7,代码来源:da.py


注:本文中的OFS.SimpleItem.SimpleItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。