[Zope] Using the DTML REQUEST Object

Tino Wildenhain tino at wildenhain.de
Tue Jul 18 14:40:22 EDT 2006


Muk Yan wrote:
> Dear Exalted Sirs and Madams,
> 
> I'm a Zope newbie, so be gentle.
> 
> I'm using DTML on Zope (yes I know Plone and Tal is now the norm) and

No, Plone has nothing to do with TAL (although it uses it too)
But nobody forces you to DTML either. You can use python scripts
and ZPT (TAL) is just easy - much lesser to type.

> I was wondering if regularly using the REQUEST(set and get) object is
> bad practice.

You should avoid that if possible.

> I'm mostly a C++ programmer and I know of the horrors of global
> variables, but I was wondering if there was any way to pass

DTML is pure horror in this regard. You see every little object/variable
everywhere. All namespaces are a big pile in DTML. You will have
a hard time finding out if a value comes from REQUEST, REQUEST.form,
Property, Object somewhere down the aquisition path or even local
loop and <dtml-with> namespaces.

> information from DTML Documents to DTML Methods and vice versa (and
> maybe from DTML Methods to DTML Methods) without using the REQUEST
> object.
*shiver* You need to have a good portion of masochism to work with
that ;) But you can call DTML with DTML too. (<dtml-call, dtml-var,
dtml-whatever - all can call other dtml or python script methods)
dtml-return is able to return abitrary objects too. But as said,
its no fun to code like that. You can even call Python scripts
in DTML (and vice versa) and keep the logic of your application
out of the template. Later you can decide if you want to replace
the DTML templates with ZPT templates.

In short, if you dont do application logic with it, even DTML
is kinda acceptable. (That said: no call, set, etc. in it)


Regards
Tino Wildenhain


More information about the Zope mailing list