1. Jesper Nøhr
  2. django-piston
Issue #188 resolved

validate decorator don't pass FILES from request

Denis Kolodin
created an issue

HCC decorator don't pass files to a form and any forms with FileField haven't validated.

Original code in utils.py: {{{

!python

def validate(v_form, operation='POST'): Николай Хаверев def wrap(f, self, request, a, *kwa): form = v_form(getattr(request, operation))

    if form.is_valid():
        return f(self, request, *a, **kwa)
    else:
        raise FormValidationError(form)
return wrap

}}}

Updated: {{{

!python

def validate(v_form, operation='POST'): Николай Хаверев def wrap(f, self, request, a, *kwa): form = v_form(getattr(request, operation), files=request.FILES)

    if form.is_valid():
        return f(self, request, *a, **kwa)
    else:
        raise FormValidationError(form)
return wrap

}}}

Comments (3)

  1. Log in to comment