[Zope] NEWBIE-QUESTION concerning forms and saving input

Dieter Maurer dieter@handshake.de
Thu, 10 Jan 2002 21:55:15 +0100


cruciatuz writes:
 > I want to provide the visitor on my website a form like that:
 > 
 > email: __________ | sendbutton
 > 
 > to subscribe to a newsletter (exactly: to fetch the email address
 > from the visitor and to write it into a single file)
 > 
 > the newsletter will be manually generated. 
 > 
 > How can i do that exactly?
 > Do i need a dtml-method for fetching the email address?
You need an action, your form is send to.
This may be a DTML object or a Python Script or an External Method.

 > How do i append the address to a file in the same zope-directory?
What do you mean with "Zope directory"?

When you mean a file system directory (i.e. not in the ZODB), then
an External Method would be best as action, because DTML objects
and Python Scripts are unable to write to file system files.

It is not so easy to append something to a "File" object in the ZODB,
because they are not made to be easily appended. You need
to use the "manage_upload" to set the file content with the
new appended email. In the ZODB, it would be easier, to keep
the Email addresses in a property (e.g. "lines" property)
and use "manage_changeProperties" to set the property after the
Email is appended.


Dieter