Plone 基于原型的内容类型可以';不可观看

Plone 基于原型的内容类型可以';不可观看,plone,plone-4.x,archetypes,Plone,Plone 4.x,Archetypes,我有一个小的Plone扩展,它包含一个简单的基于原型的内容类型(与我无法添加TTW的内容类型相同,请参阅);项目设置为 添加对象后,在执行plone.UpperContentTitle内容提供程序期间,我得到一个KeyError:“视图”: {'container': <MyType at /plone/test-for-new-types/a-mytype-object>, 'context': <MyType at /plone/test-for-new-types/a-

我有一个小的Plone扩展,它包含一个简单的基于原型的内容类型(与我无法添加TTW的内容类型相同,请参阅);项目设置为

添加对象后,在执行
plone.UpperContentTitle
内容提供程序期间,我得到一个
KeyError:“视图”

{'container': <MyType at /plone/test-for-new-types/a-mytype-object>,
 'context': <MyType at /plone/test-for-new-types/a-mytype-object>,
 'default': <object object at 0x7fc4f8ebe520>,
 'here': <MyType at /plone/test-for-new-types/a-mytype-object>,
 'loop': {},
 'nothing': None,
 'options': {'args': ()},
 'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x7fc4c9484db8>,
 'request': <HTTPRequest, URL=https://my.testing.site/test-for-new-types/a-mytype-object/mytype_view>,
 'root': <Application at >,
 'template': <FSPageTemplate at /plone/test-for-new-types/a-mytype-object/mytype_view>,
 'traverse_subpath': [],
 'user': <PloneUser 'me'>}
{'container':,
“上下文”:,
“默认值”:,
“这里”:,
'循环':{},
“没有”:没有,
'options':{'args':()},
“重复”:,
“请求”:,
“根”:,
“模板”:,
“遍历子路径”:[],
“用户”:}
develope
模式下安装我的小扩展后,它应该很容易复制

编辑:
我注意到,在“已安装的产品”视图(
/portal\u quickinstaller/MyCompany.MyProduct/manage\u installationInfo
)中,我的产品具有
状态:Installed
类型MyType
,但
内容类型注册表项
为空(
),它期望出现一个
视图
-参数[1],而基于皮肤的模板不提供,这与基于浏览器的模板相矛盾。 为了解决这个问题,我们可以像在
main\u模板中一样使用全局
@@plone
-var[2],因为
@@plone
BrowserView
的一个实例,它提供了视图参数:

tal:define="view context/@@plone;"
这让我认为,内容提供商使用的适配器应该考虑到没有可用视图的情况

如果您想拥有通常的站点结构,只需自定义内容部分,您还可以将模板填充到内容槽中,然后继承主模板中的所有内容,以及视图变量:

<metal:main metal:use-macro="context/main_template/macros/master">
  <metal:content fill-slot="content">
    Hey, a working content-provider:
    <div tal:replace="structure provider:plone.abovecontenttitle" />
    Oh, so much more much, here...
  </metal:content>
</metal:main>

嘿,工作内容提供商:
哦,太多了,这里。。。
这是我的建议,因为这样你就不必担心在标题部分做的每件事都是正确的。例如,不必使用“raiseAnon”,因为项目的工作流状态正在处理该问题,并且将评估当前语言等内容

如果您只想自定义内容项的主体部分,请将
内容
更改为
内容核心
,然后将呈现通常的内容提供程序,如果您希望按照通常的顺序插入它们,则无需插入它们

[1]


[2]

不可复制,正在获取“AttributeError:@@transform”,这是您的视图模板的派生。很抱歉,谢谢您的尝试。我删除了
转换
部分。@艾达:我将
默认视图
即时视图
属性更改为
基本视图
;现在我的类型可以这样看。在使用(仍然存在的)
mytype\u视图时,我仍然收到
'view'
键错误,不理解原因。也许它与内容提供商有关?(我希望这是可复制的。)非常感谢!我把最小可能的解决方案推到GibHub回购协议上。