We're working with our own existing code base with a bunch of custom
widget changes, so hopefully this still applies.

I have a problem with form validation.  We create custom forms all the
time, because we want to have a better layout than the TableForm or
ListForm.

One such form contains something that extends SelectionField.  This widget
needs its list of options when it's instantiated (it's possible to do it
later, but you'd have to pass it its own validator...).  The list of
options for the widget is taken from the current user, so we have to
generate the form at request time, not before.  To use this form for
validation, we pass it to the validate decorator as a class, not an
instance.

Some recent changes went in, including the can_access_request (base.py)
function that looks at the widget's path and sees if the widgets above it
are the same as the validated_form.  In our case, it is not.

I narrowed it down to the controllers.py file, line 108.  If the validate
decorator is passed something that is callable and not a widget, it will
instatiate it.  The problem is that it passes 'self' as the first
parameter.  The first parameter to a form is its name, so the
validated_form gets a name of my controller instance.

I'm pretty lost at this point.  I don't know which direction the widgets
are supposed to be going so that we can continue to steer ourselves that
way.

Thoughts?

Jason

-- 
If you understand, things are just as they are.  If you do not understand,
things are just as they are.

Attachment: pgpKNmKl1VtX3.pgp
Description: PGP signature

Reply via email to