On Thursday 10 November 2005 19:55, John Smith wrote:
> I then created a nice page template which contains
> this snippet:
>
> <div tal:content="python:context.getTotalDistance()"
> />
>
> where context is the Car object.

This is wrong, because Car does not have a function called getTotalDistance. 
In the view class do:

class View:

  def getTotalDistance(self):
    total = interfaces.IDistanceTotal(self.context)
    return total.getTotalDistance()

In the view do:

  <div tal:content="view/getTotalDistance" />

Note that you should never ever put a python call into your template.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to