當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。