|
I’m using TurboGears and its associated entourage of python modules for a couple of different projects, and I love it! I’ve read over the code and I’m really happy with how well it’s all designed. Elegant, amazing stuff that fits together very well! I’d like to help out debugging and developing it.
Here’s a description of a wee problem I’m having with FormEncode:
I installed latest TurboGears 0.8a4, which installed FormEncode rev 1104
Couldn’t get FormEncode’s validators.DateConverter to work, because it was trying to call assert_string, which should have been defined in FancyValidator, but wasn’t.
So I upgraded to the latest FormEncode rev 1182, which had assert_string.
That fixed the problem with assert_string being undefined, but led to other problems.
When I submitted my form with a date in the form of “2005-11-01 19:32:55”, and it caused a (handled) validation error (although I think it should have validated correctly, but it failed to match _day_date_re).
The validation error was not being handled by TurboGears correctly, because turbogear’s controllers.py tries to go “raise turbogearsvalid.Invalid(str(errors))”, which causes an error “TypeError: __init__() takes at least 4 arguments (2 given)” because the Invalid.__init__ method from formencode’s api.py expects 4 required args “self, msg, value, state, error_list=None, error_dict=None”.
In summary, I think TurboGears needs to be updated to use the latest version of FormEncode, and fixed to call the Invalid constructor with the right arguments including msg, value and state. (value and state currently missing). Also, I think FormEncode’s DateConverter should accept dates in the form “2005-11-01 19:32:55”, which is how they print out form Python by default.
-Don
|
- [TurboGears] TurboGears / FormEncode / DateConverter / valid... Don Hopkins

