Alberto Valverde <[EMAIL PROTECTED]> writes:
I was thinking of something more like a a Schema subclass (which you'd have
to subclass if you want this functionallity that did something like:
class TGSmartSchema(Schema):
def _to_python(self, value, state=None):
disabled_fields = pickle.loads(
self.decrypt(value.pop('form_state'))
)['disabled_fields']
self.disable_fields_for_request(disabled_fields, state)
return super(self, TGSmartSchema)._to_python(value, state)
That should make possible to use the same schema and let the form decide when
being displayed which fields should be disabled or whatever. Mind, that state
could not be changed client-side unless the code that generates the hash can
be called asyncronously to provide new hashes based on parameters (which
could, by the way, make the implementation less secure as more and more bits
of the key could be computed by watching how the hash varies as parameters
change (if same key is reused)). Phew... not something I'd like to implement
myself... ;)
This has this advantage that you noticed. One of the most interesting things
is being able to change the form according to the selected options...
One thing that I was thinking... How feasible would it be calling the
validator for the returned fields only? I mean, when something is disabled it
doesn't get submitted on the POST or GET action. We already know what has
been sent because these fields aren't there. Then, what we could do is adding
something like an attribute "can_be_disabled" (of course a better name is
needed) to the validator and that will be processed before the is_empty /
not_empty attributes. If the widget "can_be_disabled" and isn't there, then
skip its validator.
I believe that this could be applied to schemas as well...
Hehe, I thought colds were something you forgot about in when living in
sunny Brazil... ;)
The problem is that I live in a place where we have all four seasons of the
year every day... :-\ (Curitiba, at Paran� state). There's even a joke here:
"Do you know what comes after two rainy days in Curitiba? --- Monday!"
I must be working too much and my body must be too weak... This is not the
first cold that I get that puts me down for a while. Time to rethink what
I've been doing with myself.
But I bet that a Spanish guy would be fine here... Except that we can't offer
the 41 or 42 celsius degrees you get at noon at Plaza de Espa�a in
Madrid... ;-) (BTW, there's a nice coffee shopp there where I drunk iced
coffee for the first time... ;-))
Be seeing you,
--
Jorge Godoy <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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?hl=en
-~----------~----~----~----~------~----~------~--~---