问题
I am trying to make a page template for my dexterity product using summary_view as a starting point. However customising summary view or coping the body of summary view into my type's template yeilds:
Macro expansion failed
<type 'exceptions.KeyError'>: 'standard_view'
Is there a problem with this path, or do I have to do something else to make this template available:
<metal:block use-macro="context/standard_view/macros/content-core">
回答1:
You have to add a macros
method to your BrowserView.
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
class MyView(BrowserView):
template = ViewPageTemplateFile('my-template.pt')
@property
def macros(self):
self.template.macros
来源:https://stackoverflow.com/questions/20192834/page-template-macro-expansion-failed