本文整理汇总了Python中OFS.Folder.Folder.composite方法的典型用法代码示例。如果您正苦于以下问题:Python Folder.composite方法的具体用法?Python Folder.composite怎么用?Python Folder.composite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OFS.Folder.Folder
的用法示例。
在下文中一共展示了Folder.composite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _make_composite
# 需要导入模块: from OFS.Folder import Folder [as 别名]
# 或者: from OFS.Folder.Folder import composite [as 别名]
def _make_composite(self):
from OFS.Folder import Folder
f = Folder()
f.getPhysicalPath = lambda: ()
f.getPhysicalRoot = lambda f=f: f
from ZPublisher.HTTPRequest import HTTPRequest
f.REQUEST = HTTPRequest('', dict(HTTP_HOST='localhost:8080'), {})
from Products.CompositePage.composite import Composite
f.composite = Composite()
f.composite._setId("composite")
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
t = ZopePageTemplate(
id="template", text=template_text, content_type="text/html")
f.composite.template = t
from Products.CompositePage.slot import Slot
f.composite.filled_slots.slot_a = slot_a = Slot("slot_a")
t = f.composite.template
if t.pt_errors():
raise SyntaxError(t.pt_errors())
a1 = ZopePageTemplate(id="a1", text="<b>Slot A</b>")
f._setObject(a1.id, a1)
from Products.CompositePage.element import CompositeElement
e1 = CompositeElement('e1', f.a1)
slot_a._setObject(e1.id, e1)
return f.composite
示例2: setUp
# 需要导入模块: from OFS.Folder import Folder [as 别名]
# 或者: from OFS.Folder.Folder import composite [as 别名]
def setUp(self):
f = Folder()
f.getPhysicalPath = lambda: ()
f.getPhysicalRoot = lambda f=f: f
f.composite = Composite()
f.composite._setId("composite")
t = ZopePageTemplate(
id="template", text=template_text, content_type="text/html")
if t.pt_errors():
raise SyntaxError(t.pt_errors())
f.composite.template = t
f.composite.filled_slots.slot_a = slot_a = Slot("slot_a")
a1 = ZopePageTemplate(id="a1", text="<b>Slot A</b>")
f._setObject(a1.id, a1)
e1 = CompositeElement('e1', f.a1)
slot_a._setObject(e1.id, e1)
self.composite = f.composite
self.old_policy = setSecurityPolicy(PermissiveSecurityPolicy())
noSecurityManager()