[Zope] form/script problem
Tom Germaine
tgermaine@upei.ca
Mon, 05 Aug 2002 10:03:49 -0300
Hi All:
I am trying to upload a file as a DTML Document with a form that
calls a python script which edits the filename and file ending and then
calles a dtml method to show all DTML documents in the avc folder.
The form is:
-------
<dtml-var standard_html_header>
<h2>AVC Submit Form</h2>
<p>Upload a file to AVC folder.</p>
<form action="uploadActionScript" method="post"
enctype="multipart/form-data">
<p><input type="file" name="myfile" size="85"></p>
<p>Title: <input type="text" name="mytitle" size="70"></p>
<input type="submit">
</form>
<dtml-var standard_html_footer>
-------
and the python script is:
---------
import string
fname=string.split(myfile,'\\')[-1]
fname=string.split(fname,'.html')[0]
context.avc.manage_addDTMLDocument(fname,mytitle)
return context.avc.showFiles()
-------
Everything resides in a subdirectory of avc
When I test the script I get the error:
Error Type: NameError
Error Value: global name 'REQUEST' is not defined
When I run the form I get the error:
FileUpload instance has no attribute 'split'
I have tried variations of the script but cannot get around the errors.
Any advice would be appreciated.
Tom Germaine