[Zope] form/script problem

Maik Jablonski maik.jablonski@uni-bielefeld.de
Mon, 05 Aug 2002 15:31:45 +0200


hi,

you would need something like this in your Python-Script to get hands on 
the REQUEST:

request = container.REQUEST
myfile=request.myfile
fname=request.fname

[you must get all your web-parameters over the REQUEST!]

greetings, maik

Tom Germaine wrote:
> 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: &nbsp;<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
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )

-- 
Maik Jablonski                 __o
www.zfl.uni-bielefeld.de     _ \<_    Deutsche Zope User Group
Bielefeld, Germany          (_)/(_)               www.dzug.org