[Zope] Q: Iterating through an arbitrary number of SUBMIT form REQUEST object files/attributes?
Alexander Staubo
alex@mop.no
Mon, 25 Oct 1999 15:18:24 +0200
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On
> Behalf Of Samu
> Mielonen
> Sent: Monday, October 25, 1999 2:03 PM
> To: Zope Mailing List
> Subject: [Zope] Q: Iterating through an arbitrary number of
> SUBMIT form
> REQUEST object files/attributes?
[snip]
> Is there a way to handle a REQUEST object (from the above
> arbitrary submit form) in such a manner that that it:
[snip]
> Is this too much of an Herculean undertaking or is it something
> done easily? I'm most interested in iterating through all of the
> encoded files of a form submitted REQUEST object and saving each of
> them with a proper id and type (image, etc) inside a folder (object).
Erhm, sorry, Samu, but this _is_ how ZPublisher works. It chucks all the
raw HTTP request stuff into REQUEST and lets you easily extract it.
For example, give a form such as
<form action="Foo" method="post" enctype="multipart/form-data">
<input type="text" name="Name" value="">
<input type="submit">
</form>
then the object Foo can consist of the following DTML:
<dtml-var standard_html_header>
Your name is: <dtml-var Name>
<dtml-var standard_html_footer>
Here, REQUEST is implied because it's part of the namespace stack. Note
that REQUEST is pretty low in the namespace stack: It means that if
there is a folder or object called Name along the acquisition path, then
the above DTML will use that. So, a general, good rule of thumb is to
always reference REQUEST; thus it becomes:
<dtml-var "REQUEST.Name">
or
<dtml-var "REQUEST['Name']">
Here's a tidbit I think you'll appreciate: In your form target -- in
this case Foo -- or indeed in any DTML document or method, place the
following DTML:
<dtml-var REQUEST>
This will render a HTMLized version of the current request's REQUEST
object.
>
> Best regards,
> Samu Mielonen
>
> PS I think I'm over the tipping point at which I'm starting to
> appreciate the power of Zope, although learning is still very slow
> for me and I mungle with syntax all the time :)
>
> --
> "Our reflections on the order of society, as well as nature, are still
> dominated by the Newtonian image of massive power, exerted by
> sovereign
> agency through the operation of central force..." -Stephen Toulmin,
> "Cosmopolis"
>
Alexander Staubo
mailto:alex@mop.no
http://www.mop.no/~alex/