• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python SimpleItem.SimpleItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中OFS.SimpleItem.SimpleItem的典型用法代码示例。如果您正苦于以下问题:Python SimpleItem类的具体用法?Python SimpleItem怎么用?Python SimpleItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了SimpleItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: __getattribute__

 def __getattribute__(self, name):
     try:
         attr = SimpleItem.__getattribute__(self, 'data').get(name,
                                                              EMPTY_MARKER)
         if attr is not EMPTY_MARKER:
             return attr
     except AttributeError, e:
         pass
开发者ID:bluedynamics,项目名称:cornerstone.soup,代码行数:8,代码来源:soup.py


示例17: create_cepaa_set

    def create_cepaa_set(self, idx):
        col_id = "col%s" %idx
        env_id = "env%s" %idx
        proc_id = "proc%s" %idx
        act_id = "act%s" %idx
        app_id = "act%s" %idx
        country = 'http://spatial/%s' %idx
        dataflow_uris = 'http://obligation/%idx' %idx
        "create collection, envelope, process, activity, application"
        col = Collection(col_id, country=country, dataflow_uris=dataflow_uris)
        self.app._setOb(col_id, col)

        self.app.Templates.StartActivity = Mock(return_value='Test Application')
        self.app.Templates.StartActivity.title_or_id = Mock(return_value='Start Activity Template')
        self.create_process(self, proc_id)
        self.wf.addApplication(app_id, 'SomeFolder/%s' %app_id)

        self.app.Applications._setOb(proc_id, Folder(proc_id))
        proc = getattr(self.app.Applications, proc_id)

        app = SimpleItem(app_id)
        app.id = app_id
        app.__call__ = Mock(return_value='Test Application')
        proc._setOb(app_id, app)
        getattr(self.wf, proc_id).addActivity(act_id,
                            split_mode='xor',
                            join_mode='xor',
                            start_mode=1)
        getattr(self.wf, proc_id).begin = act_id
        self.wf.setProcessMappings(proc_id, '1', '1')

        env = Envelope(process=getattr(self.wf, proc_id),
                       title='FirstEnvelope',
                       authUser='TestUser',
                       year=2012,
                       endyear=2013,
                       partofyear='January',
                       country='http://spatial/1',
                       locality='TestLocality',
                       descr='TestDescription')
        env._content_registry_ping = Mock()
        env.id = env_id
        getattr(self.app, col_id)._setOb(env_id, env)
        setattr(self, col_id, getattr(self.app, col_id))
        setattr(self, env_id, getattr(getattr(self.app, col_id), env_id))
        getattr(self, env_id).startInstance(self.app.REQUEST)
开发者ID:eea,项目名称:Products.Reportek,代码行数:46,代码来源:common.py


示例18: __setattr__

 def __setattr__(self, name, value):
     d = self.__dict__
     if name[0] == '_':
         return SimpleItem.__setattr__(self, name, value)
     
     pm = d.get('_property_mapping', {})
     d[name] = value
     
     if hasattr(self, 'check_%s' % name):
         value = getattr(self, 'check_%s' % name)(value)
     
     mp = pm.get(name, None)
     if mp and mp != name:
         setattr(self, mp, value)
         setattr(self, '_p_changed', 1)
     else:
         SimpleItem.__setattr__(self, name, value)
开发者ID:groupserver,项目名称:Products.CustomProperties,代码行数:17,代码来源:CustomProperties.py


示例19: test_manage_propertiesForm_allows_adding

    def test_manage_propertiesForm_allows_adding(self):
        from OFS.SimpleItem import SimpleItem
        def _header(*args, **kw):
            return 'HEADER'
        def _footer(*args, **kw):
            return 'HEADER'
        container = SimpleItem()

        container.REQUEST = request = DummyRequest()
        request.set('manage_page_header', _header)
        request.set('manage_page_footer', _footer)
        request.set('BASEPATH1', '/one/two')
        setattr(request, 'URL1', '/one/two')
        request._steps = ['one', 'two']

        prd = {'ac_permissions': ('a', 'b')}
        container._getProductRegistryData = prd.get

        a = self._makeOne('extensible').__of__(container)
        form_html = a.manage_propertiesForm(request)

        self.failUnless('value=" Add "' in form_html)
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:22,代码来源:test_ActionInformation.py


示例20: test_manage_propertiesForm_allows_adding

    def test_manage_propertiesForm_allows_adding(self):
        from OFS.SimpleItem import SimpleItem

        def _header(*args, **kw):
            return 'HEADER'

        def _footer(*args, **kw):
            return 'HEADER'

        def _main(*args, **kw):
            return 'MAIN'

        container = SimpleItem()

        container.REQUEST = request = DummyRequest()
        request.set('manage_page_header', _header)
        request.set('manage_page_footer', _footer)
        request.set('manage_main', _main)
        request.set('RESPONSE', None)
        request.set('BASEPATH1', '/one/two')
        request.set('URL', '/one/two/manage_propertiesForm')
        request.set('URL0', '/one')
        request.set('URL1', '/one/two')
        setattr(request, 'URL1', '/one/two')
        request._steps = ['one', 'two']

        prd = {'ac_permissions': ('a', 'b')}
        container._getProductRegistryData = prd.get

        a = self._makeOne('extensible').__of__(container)
        # EEK short-term solution until a new Zope release is out
        from App.special_dtml import DTMLFile
        DTMLFile.encoding = None
        form_html = a.manage_propertiesForm(request)

        self.assertIn('value="Add"', form_html)
开发者ID:zopefoundation,项目名称:Products.CMFCore,代码行数:36,代码来源:test_ActionInformation.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python interfaces.IObjectWillBeAddedEvent类代码示例发布时间:2022-05-24
下一篇:
Python PropertyManager.PropertyManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap