For functions with fixed number of parameters validations works fine, Eg:
@validate(validators= {'foo': bar })
def func(self, foo=None):
pass
However I am facing difficulty to validate a function with unknown number of parameters, like for example
def func(*args, **kwargs):
'''do something'''
pass
Any idea what I should be doing?
Do arguments have any rule? Like they are all of the same type repeated or things like that?
TurboGears2 actually accepts anything with a
validatemethod as the validator. So you can use a Formencode Schema as validator http://turbogears.readthedocs.org/en/latest/turbogears/validation.html#schema-validation or you can roll your own class and raise aTGValidationErrorfrom it ( http://turbogears.readthedocs.org/en/latest/reference/classes.html#tg.validation.TGValidationError ).