我基于 Plone Dexterity 定义了一些内容类型,我希望任何内容类型都有自己的 ID。所以我使用了 zope.schema.Id 。
class IArticle(form.Schema, IImageScaleTraversable):
"""
Article
"""
form.model("models/article.xml")
id = schema.Id(
title=_(u"Identifier"),
description=_(u"The unique identifier of object."),
required=False
)
当我创建一个新的文章对象时,它工作正常,但是当我想修改现有文章的 Id 时,它总是显示错误:
{'args': (<MultiContentTreeWidget 'form.widgets.IRelatedItems.relatedItems'>,),
'context': <Article at /dev/articles/this-is-another-articles>,
'default': <object object at 0x100266b20>,
'loop': {},
'nothing': None,
'options': {},
'repeat': {},
'request': <HTTPRequest, URL=http://localhost:8083/dev/articles/this-is-another-article/@@edit>,
'template': <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0x10588ecd0>,
'view': <MultiContentTreeWidget 'form.widgets.IRelatedItems.relatedItems'>,
'views': <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0x10b309f50>}
.......
.......
.......
Module zope.tales.expressions, line 217, in __call__
Module zope.tales.expressions, line 211, in _eval
Module plone.formwidget.contenttree.widget, line 147, in render_tree
Module plone.app.layout.navigation.navtree, line 186, in buildFolderTree
Module Products.CMFPlone.CatalogTool, line 427, in searchResults
Module Products.ZCatalog.ZCatalog, line 604, in searchResults
Module Products.ZCatalog.Catalog, line 907, in searchResults
Module Products.ZCatalog.Catalog, line 656, in search
Module Products.ZCatalog.Catalog, line 676, in sortResults
Module plone.app.folder.nogopip, line 104, in documentToKeyMap
Module plone.folder.ordered, line 102, in getObjectPosition
Module plone.folder.default, line 130, in getObjectPosition
ValueError: No object with id "this-is-another-articles" exists.