[Zope] how to use the document object in a script
Terry Hancock
hancock@anansispaceworks.com
Tue, 13 May 2003 10:33:08 -0700
On Tuesday 13 May 2003 08:08 am, Wim Bekker wrote:
> The document has:
> <form action="myScript" method="POST>
> <input type="submit">
> </form>
>
> The 'myScript' has:
> Return context.title
> Context always seems to be the folder I'm working on. How
do I get the
> object (document)?
By name, as in: context.myDocument
The script is *not in* the document, it's in the same
folder. DTML documents/methods are not
container objects.
I think you're confusing calling with containment
(admittedly, DTML probably encourages this).
If you want to pass objects to the script, you
can also simply call it with arguments:
<dtml-var expr="myScript(title)">
will pass it the document's title, for example. This
is probably much better style, generally.
Of course, just to really confuse yourself, you
could pass the whole namespace:
<dtml-var expr="myScript(_)">
Then your first argument will be a mapping containing
all the names known to the document.
HTH,
Terry
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com