我需要建立存儲夫婦Plone的控制面板配置面板,我想對Plone的3存儲字符串對內部plone.app.registry
使用plone.app.registry
如果我限制自己的用戶界面,這是相當簡單的定義一個模式界面,自動構建這樣的:
class IMyPair(Interface):
value = schema.TextLine(title=u"value", required=True)
title = schema.TextLine(title=u"title", required=False)
class MyPair(object):
implements(IMyPair)
def __init__(self, value='', title=''):
self.value = value
self.title = title
class IMyConfigPanel(Interface):
entry = schema.List(
title=_(u'Foo'),
value_type=schema.Object(IMyPair, title=u"entry"),
required=True
)
我們使用這是店內portal_properties夫婦爲一個字符串項目(用分隔符)。
使用這種方法(與 「VALUE_TYPE =爲schema.object」)與plone.app.registry我得到一個例外,因爲IObjectField沒有定義IPersistent適配器。
在深入並變得瘋狂地提供我自己的適配器之前:有一種更簡單的方法來達到我的問題的最初需要?
我也切換到了schema.Dict類型的字段,但是z3c.form現在不支持任何這個小部件。 Bleah! –
很確定collective.z3cform.datagridfield是一個字典,可與plone.app.registry一起使用。 – vangheem