[Zope] ZClass "add" question
James W. Howe
jwh@allencreek.com
Mon, 24 Jan 2000 13:14:55 -0500
I've defined a new ZClass complete with customized form and add
methods. The form displays some fields for the user to enter values into
and the add method creates the ZClass and updates properties and adds
content to the ZClass based on information entered by the user from the
form. Depending on what is entered by the user, my add method may create
new objects to store in the ZClass. My problem is that I can't seem to
find a way to determine whether a user entered information. For example,
my form defines fields where the user can specify the name of an image file
along with some information about an image. If the user does not specify
an image file, I don't want to add a new ZClass instance which would hold
information about the image. In my add method, I've tried doing something
like this:
<dtml-if "REQUEST['photoFile']">
<... add the image ...>
</dtml-if>
That didn't work. Regardless of whether I entered information in photoFile
the code inside the dtml-if got executed.
I then tried:
<dtml-if "REQUEST['photoFile'] and REQUEST['photoFile'] != ''' ">
<... add the image ...>
</dtml-if>
This also failed. I added a <dtml-raise> tag to dump the contents of
'REQUEST['photoFile'] and it came out as ''. I don't understand why the
code inside the dtml-if is executing. I'm sure that I'm doing something
incredibly stupid, but I can't figure out what. Can anybody offer me any
guidance?
Thanks.
James W. Howe mailto:jwh@allencreek.com
Allen Creek Software, Inc. pgpkey: http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI 48103