validate decorator don't pass FILES from request

Issue #188 resolved
Denis Kolodin
created an issue

@validate 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