本文整理汇总了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")
示例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__()
示例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)
示例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')
示例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)
示例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")
示例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)
示例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()
示例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)
示例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)
示例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')
示例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)
示例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)
示例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)
示例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)