On Wednesday 20 August 2008 03:40:46 Matt Wilson wrote:
> On Aug 19, 9:34 pm, Jorge Godoy <[EMAIL PROTECTED]> wrote:
> > Let me try to understand what you want.
> >
> >         1. You want to receive any user_id and make it an integer, even
> > if it is not in the database?
> >         2. You want to receive any user_id and make it an integer, but
> > want to raise an exception if it isn't in the database?
>
> Your second one is what I want.
>
> > For the first case, you can use the integer validator and it is done.
> >
> > For the second case you can subclass FancyValidator and check in the
> > database inside your validator.
>
> Yeah, I figured that's *how* I could do it.  I'm curious about if I
> *should* do it this way.  Is there some subtle danger in this
> approach?

To me the answer is clear: if you

 - can reduce boilerplate
 - use ORMs as means to talk to your DB

it sure is the right way to go. So I do use this idiom, see my reply to Felix 
for a generic ModelValidator.

Diez

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to