Felix Schwarz wrote:
> Hi,
> 
> Alberto Valverde wrote:
>  > IMO, this behavior belongs in the "validate" decorator, not in expose
>  > which is already overcrowded.
> 
> Is expose really so big? Adding the filter would be a single line.

I'm referring more to the "does way too many things" meaning of
"overcrowded" than "too many lines".

> 
> I don't think the validate decorator is the right place because:
> 1. The current behavior is that all parameters on every called function will 
> be
>     converted. The conversion is useful even when there is no validation. I 
> don't
>     like to break things in non-obvious ways.

Hmmm, I hadn't considered this... you're right, this change could break
current behavior.

On the other hand, all input should (ideally) be validated so I guess
that it won't cause any practical trouble since 99% of the times a
method which deals with input will be decorated with validate anyway.

If this change should target 1.0.x I would certainly put it in "expose"
in order not to break anything in the stable version. However, given
that some things are already being changed in 1.1, which will require
upgrading client code, I think that the backwards-compatibility argument
loses some weight here.

So, my vote still goes for "validate" since I think it is where it
belongs (again, IMO...). I'm not too passionate about it though, if you
think that it'll cause more trouble than it's worth then do what you
please with my vote ;)

> 2. variabledecode is about converting the form data in a more
>     programmer-friendly structure. The expose decorator is the only one which
>     must be present.
> 
> The only change I can think of right know is that previously, all parameters 
> were decoded before the first decorator was called. When moving 
> variabledecode 
> into the expose validator, all decorators before expose will see the "raw" 
> parameters.

I see this as a feature :) It states explictly when validation/decoding
should take place. That's another reason I like the behavior more in
validate.

Alberto

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to