Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我通过表单将敏捷内容的 IntId 传递到浏览器视图中。如何将 IntId 解析回 Plone 中的原始对象?
使用IIntIds实用程序:
IIntIds
from zope.component import getUtility from zope.intid.interfaces import IIntIds intidutil = getUtility(IIntIds) object = intidutil.getObject(id)
或者,您可以使用该.queryObject()方法,它需要一个default关键字参数(默认为None),如果找不到 id 则返回。
.queryObject()
default
None