espenmn
(Espen)
November 22, 2024, 3:43pm
1
If I add a viewlet with plonecli, I end up with the following code (see below):
Why is template defined 'both places'. I would prefer to have it just in zcml. Is that possible?
<browser:viewlet
name="notification-viewlet"
for="plone.base.interfaces.IPloneSiteRoot"
manager="plone.app.layout.viewlets.interfaces.IGlobalStatusMessage"
layer="medialog.notifications.interfaces.IMedialogNotificationsLayer"
class=".notification_viewlet.NotificationViewlet"
template="notification-viewlet.pt"
permission="zope2.View"
/>
class NotificationViewlet(ViewletBase):
template = ViewPageTemplateFile('notification-viewlet.pt')
def index(self):
return super(NotificationViewlet, self).render()
yurj
(Yuri)
November 23, 2024, 5:18pm
2
Here no trace of ViewPageTemplateFile
. The name ViewPageTemplateFile
is used in views:
from plone.dexterity.browser.view import DefaultView
{{% elif view_base_class == 'CollectionView' %}}
from plone.app.contenttypes.browser.collection import CollectionView
{{% else %}}
from Products.Five.browser import BrowserView
{{% endif %}}
from zope.interface import implementer
from zope.interface import Interface
{{% if view_template %}}
# from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
{{% endif %}}
class I{{{ view_python_class_name }}}(Interface):
""" Marker Interface for I{{{ view_python_class_name }}}"""
@implementer(I{{{ view_python_class_name }}})
class {{{ view_python_class_name }}}({{{ view_base_class }}}):
{{% if view_template %}}
# If you want to define a template here, please remove the template from
and is commented out. Maybe you mixed views and viewlets?
espenmn
(Espen)
November 25, 2024, 11:29am
3
Yes, you are right, I made a new viewlet and it did not include that line, so it must be 'something I have done'.
1 Like