This works if I first extract all the web arguments with  
web.input(img={}) and pass the result to validates()  .. looking at  
the form.py source that makes sense, just strange that I never had to  
do it before.

Alec

On Oct 16, 2009, at Oct 16, 2009 - 10:19 AM, alexander lind wrote:

>
> Hi
>
> I just added File field to a form, something I have done before in
> webpy without a problem, but this time, for some reason I can't for
> the life of me figure out, I get this error when in the POST action I
> run validates() on the form:
>
> Traceback (most recent call last):
>  File "/home/alec/projects/pricecomp/web/application.py", line 240,
> in process
>    return p(lambda: process(processors))
>  File "/home/alec/projects/pricecomp/web/application.py", line 558,
> in processor
>    return handler()
>  File "/home/alec/projects/pricecomp/web/application.py", line 240,
> in <lambda>
>    return p(lambda: process(processors))
>  File "/home/alec/projects/pricecomp/web/application.py", line 249,
> in process
>    raise self.internalerror()
>  File "/home/alec/projects/pricecomp/web/application.py", line 470,
> in internalerror
>    return debugerror.debugerror()
>  File "/home/alec/projects/pricecomp/web/debugerror.py", line 299, in
> debugerror
>    return web._InternalError(djangoerror())
>  File "/home/alec/projects/pricecomp/web/debugerror.py", line 289, in
> djangoerror
>    return t(exception_type, exception_value, frames)
>  File "/home/alec/projects/pricecomp/web/template.py", line 863, in
> __call__
>    return BaseTemplate.__call__(self, *a, **kw)
>  File "/home/alec/projects/pricecomp/web/template.py", line 776, in
> __call__
>    return self._join_output(out)
>  File "/home/alec/projects/pricecomp/web/template.py", line 782, in
> _join_output
>    for name, value in out:
>  File "/home/alec/projects/pricecomp/web/debugerror.pyc", line 183,
> in __template__
>    $if ctx.output or ctx.headers:
>  File "/home/alec/projects/pricecomp/web/webapi.py", line 265, in  
> input
>    return storify(out, *requireds, **defaults)
>  File "/home/alec/projects/pricecomp/web/utils.py", line 145, in
> storify
>    value = getvalue(value)
>  File "/home/alec/projects/pricecomp/web/utils.py", line 132, in
> getvalue
>    return unicodify(x.value)
>  File "/home/alec/projects/pricecomp/web/utils.py", line 127, in
> unicodify
>    if _unicode and isinstance(s, str): return safeunicode(s)
>  File "/home/alec/projects/pricecomp/web/utils.py", line 235, in
> safeunicode
>    return obj.decode(encoding)
>  File "/usr/lib/python2.6/encodings/utf_8.py", line 16, in decode
>    return codecs.utf_8_decode(input, errors, True)
> UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0:
> unexpected code byte
>
> This only happens if I upload a binary file, uploading a text file is
> ok.
>
> Does anyone know what causes this?
>
> Thanks
> Alec
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to