Knows sombody why the id is '' (empty) and the funktion not work? I send a file with a form: ----------------------------- <form action="addFile" method="post" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" value="upload"> </form> To the python method: --------------------- def addFile(self,file): "This method adds a file" # create the file self.manage_addProduct['OFSP'].manage_addFile(id='', title='', file=file) # redirect to main page return self.REQUEST.RESPONSE.redirect(index_html, url_quote(message))) The error is: ------------- The id "" contains characters illegal in URLs. Mit freundlichen Grüssen Roger Ineichen ___________________________ Projekt01 GmbH www.projekt01.ch Langackerstrasse 8 6330 Cham phone +41 (0)41 781 01 78 mobile +41 (0)79 340 52 32 fax +41 (0)41 781 00 78 email r.ineichen@projekt01.ch ___________________________ END OF MESSAGE
well i guess its empty because you dont set it :-) maybe you should add an entry field <input name="id" /> or something like that? cheers, peter. On Fri, 26 Apr 2002, Roger Ineichen wrote:
Knows sombody why the id is '' (empty) and the funktion not work?
I send a file with a form: ----------------------------- <form action="addFile" method="post" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" value="upload"> </form>
To the python method: --------------------- def addFile(self,file): "This method adds a file" # create the file self.manage_addProduct['OFSP'].manage_addFile(id='', title='', file=file)
# redirect to main page return self.REQUEST.RESPONSE.redirect(index_html, url_quote(message)))
The error is: ------------- The id "" contains characters illegal in URLs.
Mit freundlichen Grüssen Roger Ineichen ___________________________
Projekt01 GmbH www.projekt01.ch Langackerstrasse 8 6330 Cham phone +41 (0)41 781 01 78 mobile +41 (0)79 340 52 32 fax +41 (0)41 781 00 78 email r.ineichen@projekt01.ch ___________________________ END OF MESSAGE
_______________________________________________ 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 )
I'm not sure, but the id should in the python method manage_addFile() set with the filename if nothing is given. ??? Is it not this way? Thanks Roger Ineichen ___________________________ END OF MESSAGE well i guess its empty because you dont set it :-) maybe you should add an entry field <input name="id" /> or something like that? cheers, peter. On Fri, 26 Apr 2002, Roger Ineichen wrote:
Knows sombody why the id is '' (empty) and the funktion not work?
I send a file with a form: ----------------------------- <form action="addFile" method="post" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" value="upload"> </form>
To the python method: --------------------- def addFile(self,file): "This method adds a file" # create the file self.manage_addProduct['OFSP'].manage_addFile(id='', title='', file=file)
# redirect to main page return self.REQUEST.RESPONSE.redirect(index_html, url_quote(message)))
The error is: ------------- The id "" contains characters illegal in URLs.
Mit freundlichen Grüssen Roger Ineichen ___________________________
Projekt01 GmbH www.projekt01.ch Langackerstrasse 8 6330 Cham phone +41 (0)41 781 01 78 mobile +41 (0)79 340 52 32 fax +41 (0)41 781 00 78 email r.ineichen@projekt01.ch ___________________________ END OF MESSAGE
_______________________________________________ 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 )
oh now i get it yes, manage_addFile() should (with the cookId() method) generate it if its not set hm, i suggest you take a look at lib/python/OFS/Image.py and try to debug this by adding some print statements. sorry for not being more specific... peter. On Fri, 26 Apr 2002, Roger Ineichen wrote:
I'm not sure, but the id should in the python method manage_addFile() set with the filename if nothing is given. ??? Is it not this way?
Thanks Roger Ineichen ___________________________ END OF MESSAGE
well i guess its empty because you dont set it :-) maybe you should add an entry field
<input name="id" />
or something like that?
cheers, peter.
On Fri, 26 Apr 2002, Roger Ineichen wrote:
Knows sombody why the id is '' (empty) and the funktion not work?
I send a file with a form: ----------------------------- <form action="addFile" method="post" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" value="upload"> </form>
To the python method: --------------------- def addFile(self,file): "This method adds a file" # create the file self.manage_addProduct['OFSP'].manage_addFile(id='', title='', file=file)
# redirect to main page return self.REQUEST.RESPONSE.redirect(index_html, url_quote(message)))
The error is: ------------- The id "" contains characters illegal in URLs.
Mit freundlichen Grüssen Roger Ineichen ___________________________
Projekt01 GmbH www.projekt01.ch Langackerstrasse 8 6330 Cham phone +41 (0)41 781 01 78 mobile +41 (0)79 340 52 32 fax +41 (0)41 781 00 78 email r.ineichen@projekt01.ch ___________________________ END OF MESSAGE
_______________________________________________ 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 )
_______________________________________________ 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 )
Roger Ineichen wrote:
Knows sombody why the id is '' (empty) and the funktion not work?
I send a file with a form: ----------------------------- <form action="addFile" method="post" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" value="upload"> </form>
To the python method: --------------------- def addFile(self,file): "This method adds a file" # create the file self.manage_addProduct['OFSP'].manage_addFile(id='', title='', file=file)
# redirect to main page return self.REQUEST.RESPONSE.redirect(index_html, url_quote(message)))
The error is: ------------- The id "" contains characters illegal in URLs.
<dtml-comment>----------------------------------------------------------- Edit load </dtml-comment> <tr><td><b>Load from File?</b></td></tr> <tr><td><form name="form" action="<dtml-var "URL1">/manage_load_file" method="POST" ENCTYPE="multipart/form-data"> <tr><td><INPUT TYPE="file" NAME="fid" SIZE="50" /><br> <input type="radio" name="ft" value='txt' checked /> as txt ( repr )<sup><b>*</b></sup> <input type="radio" name="ft" value='tbs' /> as tbs (pickle) <input type="submit" value=" Load " /> </td></tr> <tr><td></form> </td></tr> and def manage_load_file(self, ft, fid, REQUEST=None): """load tabstree from client file, ftype/format: 'tbs'=unpickle, 'txt'=eval""" f_type = ft # dunno how to detect filetype, made radio buttons file = REQUEST[ 'fid' ] if file == None: # code copied, dont understand it myself f_head = '' f_data = '' else: f_head = hasattr( file, "headers" ) and file.headers or None f_data = (f_head is None) and file or file.read() if f_type == 'tbs': # a) unpickle/pickle 3 lines tmpFile = StringIO(f_data) tmpPick = pickle.Unpickler(tmpFile) self.tabstree = [] # just to be safe self.tabstree = tmpPick.load() worked fine for me -- ------------------------------------------------------------- Who's got only a hammer sees the world as a nail hans augustin (software developer) hans@beehive.de beehive elektronische medien GmbH http://www.beehive.de phone: +49 30 847-82 0 fax: +49 30 847-82 299
participants (3)
-
hans -
Peter Sabaini -
Roger Ineichen