How do I call a method which is in the filesystem from a TAL Portlet (made available by collective.portlet.tal
)?
This is how I did it: I defined a new BrowserView (createPictMenu.py
in my case) and then registered it as the renderer for a new portlet component:
class AddressTAL(BrowserView)
def my_address()
address_bar = ViewTemplatePageFile('templates/address_left.pt') # this
is the page template I want for my new portlet.
And in configure.zcml
:
<plone:portlet
name="collective.portlet.tal.TALPortlet"
interface="collective.portlet.tal.talportlet.ITALPortlet"
assignment="collective.portlet.tal.talportlet.Assignment"
view_permission="zope2.View"
edit_permission="cmf.ManagePortal"
renderer=".browser.createPictMenu.AddressTAL"
addview="collective.portlet.tal.talportlet.AddForm"
editview="collective.portlet.tal.talportlet.EditForm"
/>
Then I went to localhost:8080/myproject/@@manage-portlets and selected the TAL Portlet option
from the Add Portlet dropdown list. I informed title as address and for description I inserted the snippet below to call address_tal()
:
<span tal:define="global li view/myaddress">
<span tal:replace="structure li" />
</span>
Unfortunately, it didn't work. Please help.