今天我们使用“多注册表模式代理”类来实现这一点,但我们认为应该有更好的方法来处理 Plone 的选项卡:
https://github.com/collective/collective.nitf/blob/1.x/src/collective/nitf/controlpanel.py#L163-L202
今天我们使用“多注册表模式代理”类来实现这一点,但我们认为应该有更好的方法来处理 Plone 的选项卡:
https://github.com/collective/collective.nitf/blob/1.x/src/collective/nitf/controlpanel.py#L163-L202
IMO 使用选项卡创建 configlet 的最简单方法是使用plone.supermodel:
from my.package import MessageFactory as _
from plone.supermodel import model
from zope import schema
class IMyConfigletSettings(model.Schema):
"""Schema for the control panel form."""
field_one = schema.Text(
title=_(u'Field One'),
default='',
)
model.fieldset('tab_a', label=_(u'Tab A'), fields=['field_a'])
field_a = schema.Text(
title=_(u'Field A'),
default='',
)
model.fieldset('tab_b', label=_(u'Tab B'), fields=['field_b'])
field_b = schema.Text(
title=_(u'Field B'),
default='',
)
这将创建一个具有 3 个字段和 3 个选项卡(每个选项卡一个字段)的 configlet。
查看 sc.social.like 包,了解一个实际的工作示例。
也许从现在开始这可以被认为是规范的方式。