[Python] So che deve essere una cosa semplice ma

Raffaele Salmaso raffaele a salmaso.org
Lun 1 Giu 2015 19:26:08 CEST


2015-06-01 17:31 GMT+02:00 Carlos Catucci <carlos.catucci at gmail.com>:

> io non ci salto fuori.
>
> Scenario: devo inviare dei files al server. Con Django.
>
[si potrebbe postare su django-it... :P]



> Ho la mia brava form
>
> <form action="/products_editor/upload_file/" method="POST"
> enctype="multipart/form-data">                 {% csrf_token %}
>     ......
>     <input type='submit' class='small_text' value='INVIA'>
> </form>
>
>
> E fino qui tutto bene.
> Vediamo la views.py
>
> def upload_file( request ):
>
> try:
>
>   if request['method'] == 'POST':
>
?
l'ultima volta che l'ho vista mi sembrava request.method == 'POST' (circa
20 secondi fa, che è
un tempo abbastanza lungo in informatica: saranno nati almeno 3 framework
js nel frattempo...)

[...]

>
> 'WSGIRequest' object has no attribute '__getitem__'
>
appunto...



--
EZLN ... Para Todos Todo ... Nada para nosotros

>
> _______________________________________________
> Python mailing list
> Python at lists.python.it
> http://lists.python.it/mailman/listinfo/python
>
>


-- 
| Raffaele Salmaso
| http://salmaso.org
| https://bitbucket.org/rsalmaso
| http://gnammo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.python.it/pipermail/python/attachments/20150601/1f06374f/attachment.html>


Maggiori informazioni sulla lista Python