Hello Samuele,

> In data venerdì 3 maggio 2013 14:23:23, Ferran Jorba ha scritto:
>> it turns out that I have several mod_python scripts to handle local
>> file uploading needs.  After many hours of digging in, I have
>> confirmed that file uploading is not implemented under the simplified
>> Invenio SimulatedModPythonRequest.  Is that right?
>
> yep, it is :-)

Sorry, I don't understand if you confirm that it is implemented in
your SimulatedModPythonRequest or that it is not implemented and I
should use ckeditor.

> Simply if you set up an HTML form that has a file element, say called
> “file”, then in req does everything (as in mod_python), in req.form
> (which behaves like a dictionary), you will find the “file” key that
> has special properties (e.g. you can call req[‘form’].filename to
> retrieve the intended filename, and you can call req[‘form’].file to
> obtain an open stream to the read the content of the file.

I've tried both a plain SimulatedModPythonRequest form and a ckeditor
form, and both as req['form'].filename (as you wrote) and
req.form['filename'] (like the other fields), and none of them works:


Plain SimulatedModPythonRequest:

 filename = req['form'].filename
 TypeError: 'SimulatedModPythonRequest' object is unsubscriptable 
(<string>:162:upload)

 filename = req.form['filename']
 KeyError: 'filename' (webinterface_handler_wsgi_utils.py:680:__getitem__)

Using ckeditor:

 filename = req.form['filename']
 TypeError: 'NoneType' object is not iterable 
(webinterface_handler_wsgi.py:603:mp_legacy_publisher)


 filename = req['form'].filename
 TypeError: 'NoneType' object is not iterable 
(webinterface_handler_wsgi.py:603:mp_legacy_publisher)


Would you mind to clarify me which framework should I use, and confirm
the right syntax (req['form'].filename or req.form['filename']), as all
my tests have been unsuccessful?  Or point me to an example, because, as
much as I tried, I wasn't able to find a simple one?

Thanks again,

Ferran

Reply via email to