Using the DTML REQUEST Object
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 I was wondering if regularly using the REQUEST(set and get) object is bad practice. 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 information from DTML Documents to DTML Methods and vice versa (and maybe from DTML Methods to DTML Methods) without using the REQUEST object. Thanks and take care, Muk Yan
--On 18. Juli 2006 13:33:59 -0400 Muk Yan <myan@umich.edu> 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 I was wondering if regularly using the REQUEST(set and get) object is bad practice.
It's *bad practice*
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 information from DTML Documents to DTML Methods and vice versa (and maybe from DTML Methods to DTML Methods) without using the REQUEST object.
If you need to pass parameters to other objects, pass them. -aj
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
On Tuesday 18 July 2006 19:33, Muk Yan wrote:
I'm using DTML on Zope (yes I know Plone and Tal is now the norm) and I was wondering if regularly using the REQUEST(set and get) object is bad practice.
If you want a variable whose scope is a single request, then use the REQUEST object. If, on the other hand, your purpose is to work around the fact that DTML is not a general purpose language, but rather a document templating language, use PythonScripts instead. IMHO, of course.
I was wondering if there was any way to pass information from DTML Documents to DTML Methods and vice versa (and maybe from DTML Methods to DTML Methods) without using the REQUEST object.
There's at least two ways to pass variables between DTML-objects: <dtml-let var1="'one'" var2="'two'"> <dtml-var other_dtml> </dtml-let> <dtml-var "other_dtml(_.None,_,var1='three',var2='four')"> HTH
participants (4)
-
Andreas Jung -
Berthold Stöger -
Muk Yan -
Tino Wildenhain