Hi list
I have a controller method exposed only as JSON and I'm using a
validator to convert the received params properly. The question is:
what happens when the validator fails? To be more specific, here is
some code:
@tg.expose(format="json")
@tg.validate(validators={"item_id":val.Int})
def deleteTipo(self,item_id):
tipo_id=item_id
try:
tipo=m.TipoCita.get(tipo_id)
tipo.destroySelf()
except psy.IntegrityError:
return dict(tg_errors=u"Elements depend of the type")
except Exception:
return dict(tg_errors=u"The type doesn't exist")
return dict()
so what will happen when the validator (val.Int) fails??
Thanks,
Javier Rojas
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
- [TurboGears] validation and JSON Javier Rojas
- [TurboGears] Re: validation and JSON pythonwin

