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


Python publish.mapply函数代码示例

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


在下文中一共展示了mapply函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testClass

    def testClass(self):
        values = {"a": 2, "b": 3, "c": 5}

        class c(object):
            a = 3

            def __call__(self, b, c=4):
                return "%d%d%d" % (self.a, b, c)

            compute = __call__

        cc = c()
        v = mapply(cc, (), values)
        self.failUnlessEqual(v, "335")

        del values["c"]
        v = mapply(cc.compute, (), values)
        self.failUnlessEqual(v, "334")

        class c2:
            """Must be a classic class."""

        c2inst = c2()
        c2inst.__call__ = cc
        v = mapply(c2inst, (), values)
        self.failUnlessEqual(v, "334")
开发者ID:wpjunior,项目名称:proled,代码行数:26,代码来源:test_mapply.py

示例2: __call__

 def __call__(self):
     mapply(self.update, (), self.request)
     agenda_recente = self.agenda_recente()
     if agenda_recente and not self.editable:
         return agenda_recente.restrictedTraverse('@@view')()
     else:
         return super(AgendaView, self).__call__()
开发者ID:plonegovbr,项目名称:brasil.gov.agenda,代码行数:7,代码来源:agenda.py

示例3: __call__

 def __call__(self):
     self.layout = self._get_layout()
     mapply(self.update, (), self.request)
     if self.request.response.getStatus() in (302, 303):
         # A redirect was triggered somewhere in update().  Don't
         # continue rendering the template or doing anything else.
         return
     return self.layout(self)
开发者ID:jean,项目名称:grokcore.layout,代码行数:8,代码来源:components.py

示例4: testMethod

    def testMethod(self):
        def compute(a,b,c=4):
            return '%d%d%d' % (a, b, c)
        values = {'a':2, 'b':3, 'c':5}
        v = mapply(compute, (), values)
        self.failUnlessEqual(v, '235')

        v = mapply(compute, (7,), values)
        self.failUnlessEqual(v, '735')
开发者ID:Andyvs,项目名称:TrackMonthlyExpenses,代码行数:9,代码来源:test_mapply.py

示例5: __call__

 def __call__(self):
     mapply(self.update, (), self.request)
     if self.request.response.getStatus() in (302, 303):
         # A redirect was triggered somewhere in update().  Don't
         # continue rendering the template or doing anything else.
         return
     self.layout = zope.component.getMultiAdapter(
         (self.request, self.context), ILayout)
     return self.layout(self)
开发者ID:grodniewicz,项目名称:oship,代码行数:9,代码来源:components.py

示例6: testMethod

    def testMethod(self):
        def compute(a, b, c=4):
            return "%d%d%d" % (a, b, c)

        values = {"a": 2, "b": 3, "c": 5}
        v = mapply(compute, (), values)
        self.assertEqual(v, "235")

        v = mapply(compute, (7,), values)
        self.assertEqual(v, "735")
开发者ID:pombredanne,项目名称:zope.publisher,代码行数:10,代码来源:test_mapply.py

示例7: __call__

    def __call__(self):
        mapply(self.update, (), self.request)
        if self.request.response.getStatus() in (302, 303):
            # A redirect was triggered somewhere in update().  Don't
            # continue rendering the template or doing anything else.
            return

        template = getattr(self, 'template', None)
        if template is not None:
            return self._render_template()
        return mapply(self.render, (), self.request)
开发者ID:grodniewicz,项目名称:oship,代码行数:11,代码来源:components.py

示例8: __call__

    def __call__(self):
        mapply(self.update, (), self.request)
        if self.response.getStatus() in (302, 303):
            # A redirect was triggered somewhere in update().  Don't
            # continue processing the form
            return

        self.updateForm()
        if self.response.getStatus() in (302, 303):
            return

        return self.render()
开发者ID:thefunny42,项目名称:Zeam-Form,代码行数:12,代码来源:form.py

示例9: testAncientMethod

 def testAncientMethod(self):
     # Before Python 2.6, methods did not have __func__ and __code__.
     # They had im_func and func_code instead.
     # This may still be the case for RestrictedPython scripts.
     # Pretend a method that accepts one argument and one keyword argument.
     # The default value for the keyword argument is given as a tuple.
     method = AncientMethod('7 * %d + %d', (0,))
     values = {}
     v = mapply(method, (6,), values)
     self.assertEqual(v, 42)
     v = mapply(method, (5, 4), values)
     self.assertEqual(v, 39)
开发者ID:minddistrict,项目名称:zope.publisher,代码行数:12,代码来源:test_mapply.py

示例10: __call__

    def __call__(self):
        mapply(self.update, (), self.request)
        if self.request.response.getStatus() in (302, 303):
            # A redirect was triggered somewhere in update().  Don't
            # continue processing the form
            return
        self.updateForm()
        if self.request.response.getStatus() in (302, 303):
            return

        self.layout = getMultiAdapter(
            (self.request, self.context), ILayout)
        return self.layout(self)
开发者ID:prinzdezibel,项目名称:p2.datashackle.management,代码行数:13,代码来源:base.py

示例11: testClass

    def testClass(self):
        values = {'a':2, 'b':3, 'c':5}
        class c(object):
            a = 3
            def __call__(self, b, c=4):
                return '%d%d%d' % (self.a, b, c)
            compute = __call__
        cc = c()
        v = mapply(cc, (), values)
        self.assertEqual(v, '335')

        del values['c']
        v = mapply(cc.compute, (), values)
        self.assertEqual(v, '334')
开发者ID:minddistrict,项目名称:zope.publisher,代码行数:14,代码来源:test_mapply.py

示例12: __call__

    def __call__(self):
        __traceback_supplement__ = (ErrorSupplement, self)

        layout_factory = component.getMultiAdapter(
            (self.request, self.context,), ILayoutFactory)
        self.layout = layout_factory(self)

        mapply(self.update, (), self.request)

        if self.request.response.getStatus() in (302, 303):
            # A redirect was triggered somewhere in update().  Don't
            # continue rendering the template or doing anything else.
            return

        return self.layout(self)
开发者ID:infrae,项目名称:infrae.layout,代码行数:15,代码来源:components.py

示例13: __call__

    def __call__(self):
        convert_request_form_to_unicode(self.request.form)

        self.layout = component.getMultiAdapter(
            (self.request, self.context), ILayout)

        mapply(self.update, (), self.request)
        if self.request.response.getStatus() in (302, 303):
            # A redirect was triggered somewhere in update(). Don't
            # continue processing the form
            return

        self.updateForm()
        if self.request.response.getStatus() in (302, 303):
            return

        return self.layout(self)
开发者ID:silvacms,项目名称:zeam.form.silva,代码行数:17,代码来源:public.py

示例14: callObject

 def callObject(self, request, ob):
     # Exception handling, dont try to call request.method
     orig = ob
     #if not IHTTPException.providedBy(ob):
     #    ob = getattr(ob, request.method, None)
     #    if ob is None:
     #        raise MethodNotAllowed(orig, request)
     return mapply(ob, request.getPositionalArguments(), request)
开发者ID:avnik,项目名称:nanozope,代码行数:8,代码来源:publisher.py

示例15: callObject

    def callObject(self, request, ob):
        """Call the object, returning the result.

        For GET/POST this means calling it, but for other methods
        (including those of WebDAV and FTP) this might mean invoking
        a method of an adapter.
        """
        from zope.publisher.publish import mapply
        return mapply(ob, request.getPositionalArguments(), request)
开发者ID:grodniewicz,项目名称:oship,代码行数:9,代码来源:test_vhosting.py


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