"The value of each reference will be calculated once at start-up and a 
cached version will be used thereafter." -- that's just sooo no-intuitive. 
And why would I even keep the template object around then? The string would 
do just fine.

Consider:

 >>> from Cheetah.Template import Template as T
 >>> values = {'name': 'chck'}
 >>> src = 'Hello $name.'
 >>> t = T(src, values)
 >>> print t
Hello chck.
 >>> values['name'] = 'Chuck'
 >>> print t
Hello chck.


I currently work around this by throwing the Template away every time. But 
then I don't get any benefit from the compilation. Maybe I'm even getting 
some overhead.

I hope you're not gonna give the me '*' explanation as in $*var. No other 
templating system, not Velocity, WebMacro, DTML, etc., makes template 
writers add an extra symbol in order to emphatically declare that "yes, 
this variable will vary".

Consider a simple news template:

------
<h1>$title</h1>
<br> $date
<p> $body
<hr>
$author
------

I can't create a Template out of this and reuse it for N records in the 
database. I have to throw it away each time and lose the benefits of 
compilation. Or I could tell my users that Cheetah, for practical purposes, 
is really a $*# syntax:

------
<h1>$*title</h1>
<br> $*date
<p> $*body
<hr>
$*author
------

Which is opposite of shell syntax, Velocity, "reduced symbology", etc.

I think the default behavior should be that variable values are fetched 
upon rendering.


-Chuck


_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to