Plonecli viewlet template (registration)

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()

Here no trace of ViewPageTemplateFile. The name ViewPageTemplateFile is used in views:

and is commented out. Maybe you mixed views and viewlets?

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