[Zope] change variable

Ben Avery ben@thesite.org
Tue, 23 Jul 2002 18:17:45 +0100


I agree with Charlie, I think DTML has been designed not to make it easy 
to do any kind of business logic. Zope Page Templates are more recent, 
and have even less capacity for programming logic.

I'm newish to Zope myself, but for any development I do now, I only use 
DTML for presentation itself.
For each page of the site I'm developing, I have a Python script, e.g. 
calendar_view_handler to take any form inputs from the previous page, 
use things from the session, call and use ZSQL methods, and put 
everything I need for the next page, in nice data structures into the 
request object, then call the DTML method, e.g. calendar_view_display, 
which only uses DTML variables to loop over data structures, and maybe 
do simple 'this or that' splits if I absolutely have to.
This allows a clean separation of logic and presentation, and means you 
don't have this constant wrestle against the limitations of DTML.
Using Python is actually a lot easier than using DTML - don't be scared 
by it, it's the easiest language to learn I've come across :)

Ben Avery
YouthNet UK

Ed Leafe wrote:

> On Tuesday, July 23, 2002, at 12:45  PM, Charlie Reiman wrote:
>
>> Uh, dtml-let is NOT equivalent to REQUEST.set. This is not an either/or
>> decision here. dtml-let is a namespace operator, much like Lisp's 
>> (let ...)
>> operator. Unforunately, most people assume let is like BASIC's let, 
>> which is
>> assignment, not namespace creation.
>>
>> To put it another way, DTML does not prevent you from assigning 
>> values to
>> variables, but it does nothing to make it easy (like providing 
>> syntax). I've
>> always wondered if there was a design decision behind this or just a 
>> simple
>> oversight.
>
>
>     Well, in my case, I am taking values from a form, cleaning them up 
> (removing punctuation from phone numbers, etc.), and then updating a 
> database with these 'processed' values. I changed one of my methods 
> from dtml-let to REQUEST.set, and it worked perfectly while becoming 
> much, much cleaner. So while the two may not be equivalent, they both 
> do what I need, and REQUEST.set is far superior for this.
>
>      ___/
>     /
>    __/
>   /
>  ____/
>  Ed Leafe
>  http://leafe.com/
>  http://foxcentral.net
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>