Is it a bug or a feature? EasyCrudRestController misbehaves on failed vaildation

27 views
Skip to first unread message

Moritz Schlarb

unread,
Apr 16, 2012, 4:16:54 AM4/16/12
to turbo...@googlegroups.com
Hi again! ;)

I have a Subsubclass of EasyCrudRestController and want to add a custom validator using

    __form_options__ = {
        '__base_validator__':passwordValidator,
        }

But because the action does point to ./, you get to the url without edit at the end, but with the edit form displayed.
The big problem is that at this point the selected items on MultipleSelectFields are missing.
Is this a bug or am I doing something wrong?

In my intuition, the post should redirect to /edit again, if validation failed, shouldn't it?

Regards,
Moritz

Alessandro Molina

unread,
Apr 16, 2012, 4:42:42 AM4/16/12
to turbo...@googlegroups.com
The fact that you get /crud/3/ instead of /crud/3/edit when validation
fails shouldn't cause issues, the important part is that you get
/crud/3/ and not /crud/3 as in that case the crud controller wouldn't
be able to correctly use the path.

If you are not getting the last / at the end of the url it might be
due to the fact that you overridden some method of the crud controller
that has the @with_trailing_slash decorator and forgot to put the
@with_trailing_slash decorator again.

> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/K5WUfe3Z8d0J.
> To post to this group, send email to turbo...@googlegroups.com.
> To unsubscribe from this group, send email to
> turbogears+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.

Moritz Schlarb

unread,
Apr 16, 2012, 7:19:17 PM4/16/12
to turbo...@googlegroups.com
Hm, no, I havent overridden any method... The redirection to /crud/3/ is correct, but any content in MultipleSelectFields is lost thereby.
Seems like some kind of bug to me, or do you have any other idea?

To test it, you could probably use the auth model and make an EasyCrudRestController for model=User. When you try to edit a user and e.g. leave the user_name empty, you should get a validation error and the MultipleSelectField for groups should be cleared...
Reply all
Reply to author
Forward
0 new messages