"Max Ischenko" <[EMAIL PROTECTED]> writes:

> And I argue that TextField may need to know whether it is required or not
> regardless of validator. For instance, to display itself differently. And if

What about the use of "css_classes" with a "required" class when you want to
display it different?  You know it is required, so you just add a new CSS
class and that's it.

> you agree with that and agree that querying validator about it not an option
> then adding "is_required" is the only way to go.

I prefer using CSS classes for presentation purposes.  The validation, to me,
is only about receiving and sending information.  Of course, it says that an
information *is* or *is not* required, but this is -- at least to me -- not
specifically tied with presentation.

> Another option is not to combine them at all. Attribute "is_required" related
> to view and let it be separate from whatever validatation method is used. This

This is what I believe is the best.

> arguably breaks DRY as you would have to write TextField(is_required=True,
> validator=Int(not_empty=True)) but OTOH explicit is better than implicit.

Indeed.  And we keep the V and C in MVC separated...


-- 
Jorge Godoy      <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to