【发布时间】:2013-01-31 05:22:04
【问题描述】:
在使用 Plone 时,我已将 DocumentViewer product 集成到我的 Plone 应用程序中,以帮助查看 PDF 文件。文档查看器附加产品定义了一组架构/字段,可以在控制面板设置中查看,即站点设置 -> 文档查看器设置。
您可以查看字段/模式是如何定义的here
现在我想通过在我的 example.product 中覆盖 IGlobalDocumentViewerSettings 接口来添加另一个字段。
我认为我不能使用SchemaExtender,因为它们不是原型。我也尝试按照by this link 提供的说明进行操作,但无济于事。我可以重新安装我的产品,但未显示我添加的字段。
这是我的代码示例:
from collective.documentviewer.interfaces import IGlobalDocumentViewerSettings
from collective.documentviewer.interfaces import IDocumentViewerSettings
from zope import schema
from zope.interface import implements
class DocViewerSchemaProvider(object):
implements(IGlobalDocumentViewerSettings)
def getSchema(self):
"""
"""
return IEnhancedDocumentViewerSchema
class IEnhancedDocumentViewerSchema(IDocumentViewerSettings):
"""
Use all the fields from the default schema, and add various extra fields.
"""
folder_location = schema.TextLine(
title=u"Default folder location",
description=u'This folder will be created in the Plone root folder. '
u'Plone client must have write access to directory.',
default=u"files_folder")
谁能帮助我如何覆盖这个特定的界面?
【问题讨论】: