[Zope] form/script problem

Tom Germaine tgermaine@upei.ca
Mon, 05 Aug 2002 14:04:57 -0300


Thanks, I tried your suggestion, inserting after the 'import string' 
line, but I'm afaid the error messages remained the same.  Perhaps the 
syntax for the REQUEST object is incorrect, but I don't know how to 
correct it.  Further help required...

Tom Germaine

On 5 Aug 2002, at 15:31, Maik Jablonski wrote:

> 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
> 



~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Tom Germaine
System Administrator
UPEI Access Services
tgermaine@upei.ca
566-0465
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~