ToscaWidgets 2 validators again

42 views
Skip to first unread message

Christoph Zwerschke

unread,
Feb 2, 2013, 7:58:53 AM2/2/13
to toscawidge...@googlegroups.com
I'm currently trying to port a TurboGears app with a lot of custom
validators from TW1 + FE to TW2 and TW2 validators,

So I'm interested in finally clarifying the API of TW2 validators.

The problem is that the API is currently incompatible with FE in a
confusing way, see https://github.com/toscawidgets/tw2.core/issues/65
(reading the last comment suffices to understand the issue).

Please give some feedback so we can close the issue one way or the
other. I'm willing to work out a patch if a decision is made.

-- Christoph

Paul Johnston

unread,
Feb 2, 2013, 11:21:15 AM2/2/13
to toscawidge...@googlegroups.com
Chris,

If you're happy to do the work, and there's not going to be major
breakage (which I don't expect) - go ahead and make the tw2 validators
match FormEncode.

I think the approach I've taken has some advantages, especially if you
want to validate existing values saved in db. But FormEncode
compatibility outweighs this.

Paul


Sent from my iPhone
> --
> You received this message because you are subscribed to the Google Groups "ToscaWidgets-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to toscawidgets-dis...@googlegroups.com.
> To post to this group, send email to toscawidge...@googlegroups.com.
> Visit this group at http://groups.google.com/group/toscawidgets-discuss?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Christoph Zwerschke

unread,
Feb 3, 2013, 12:41:09 PM2/3/13
to toscawidge...@googlegroups.com
Am 02.02.2013 17:21, schrieb Paul Johnston:
> If you're happy to do the work, and there's not going to be major
> breakage (which I don't expect) - go ahead and make the tw2 validators
> match FormEncode.

Ok, I've just created a pull request for that.

> I think the approach I've taken has some advantages, especially if you
> want to validate existing values saved in db. But FormEncode
> compatibility outweighs this.

Right, if you only want to validate and not convert, your API with
emphasis on the validation method feels more natural.

The main problem was that the external validation method use the same
name "validate_python" as the internal method in FormEncode where it was
used only internally to validate objects that are already converted to
Python (hence the name).

Maybe the patch will also cause some confusion (particularly because it
already uses the new method names of FormEncode 1.3 instead of the old
names), but I think still less confusing than having APIs that look the
same but behave differently.

-- Christoph

Paul Johnston

unread,
Feb 10, 2013, 12:06:56 PM2/10/13
to toscawidge...@googlegroups.com
Hi,

Chris/Ralph - thanks for your work on this. I haven't updated any of my own apps yet, but I will keep my fingers crossed and hope they just work :-)

Paul





-- Christoph

--
You received this message because you are subscribed to the Google Groups "ToscaWidgets-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to toscawidgets-discuss+unsub...@googlegroups.com.
To post to this group, send email to toscawidgets-discuss@googlegroups.com.

Christoph Zwerschke

unread,
Feb 10, 2013, 12:30:49 PM2/10/13
to toscawidge...@googlegroups.com
Am 10.02.2013 18:06, schrieb Paul Johnston:
> Chris/Ralph - thanks for your work on this. I haven't updated any of my
> own apps yet, but I will keep my fingers crossed and hope they just work :-)

They should. You may get deprecation warnings if you use custom
validators or FormEncode < 1.3. These do not harm and disappear if you
upgrade to FormEncode 1.3 (no official release available yet) or change
the method names in your custom validators, as indicated in the
deprecation warnings. If you see any problems, let me know.

-- Christoph

Moritz Schlarb

unread,
Jun 11, 2013, 5:21:19 PM6/11/13
to toscawidge...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages