Noam, check out the registration cogbin. It goes:
class UniqueUsername(validators.FancyValidator):
"Validator to confirm that a given user_name is unique."
messages = {'notUnique': 'That user name is already being used.'}
def _to_python(self, value, state):
if not register_model.user_name_is_unique(value):
raise validators.Invalid(self.message('notUnique', state),
value, state)
return value
and then do the rest in the model.
A
On May 19, 8:24 pm, Noam <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I've seen the FormsTutorial on how to create forms and validate them.
> However, it doesn't say how to add further validation not handled by
> the @validate decorator. For example, I have a form for selecting a
> user name, and I want to notify the user if the user name was already
> selected. This requires DB access, and is not something that I expect
> the validation framework to do. What should I do in such a case?
>
> Thanks,
> Noam
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---