[Zope] Questions about DocumentTemplate.
Paul Everitt
Paul@digicool.com
Tue, 23 Mar 1999 06:54:23 -0500
Mark wrote:
> I want DocTemplate to expose an object model, and it seems
> perfect for the task. However, Im having trouble using "."
> expressions.
>
> Code speaks louder than words, so my code is:
> ##
> class Spam:
> def eggs(self):
> return "Eggs"
>
> spam=Spam()
>
> from DocumentTemplate import *
> ss=HTML('Eggs are <!--#var expr="spam.eggs()"-->')
> print ss(spam=spam)
Here's an alternative that works:
from DocumentTemplate import HTML
class Spam:
def eggs(self):
return "Eggs"
ss = HTML('Eggs are <!--#var eggs-->.')
s=Spam()
print s.ss(s)
and a second choice:
from DocumentTemplate import HTML
class Spam:
def eggs(self):
return "Eggs"
ss = HTML('Eggs are <!--#var eggs-->.')
s=Spam()
print s.ss(s)
--Paul