I have been following this URL to help me create template views using BrowserView. So far, it works OK and I am able to create a template with a view class.
What I need to know is whether it is possible to pass arguments to methods inside the view class i.e.
from Products.Five import BrowserView
class Html(BrowserView):
def still_dreaming(self):
msg = "Some people are still dreaming"
return msg
I need to add an extra argument to the still_dreaming function and process it inside the function like this:
def still_dreaming(self, some_arg):
msg = some_arg + " Some people are still dreaming"
return msg
Then I need to call the function and pass an argument to it from my template. Something like this:
<p tal:content="view/still_dreaming(item/publication_date)"></p>
Unfortunately, I do not know the correct way of passing arguments to the method. Any pointers will be greatly appreciated.
EDIT:
item/publication_date is just some variable and could be anything. It has just been defined previously.
Yes.
You can use TAL traversing syntax (default), Python syntax or String syntax in TAL expressions.
http://collective-docs.readthedocs.org/en/latest/functionality/expressions.html