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?

>
> One hint: unless you are using "user_id" to operate on users other than the
> one currently using the application you could try using identity's
> identity.current.user, which on a method that requires an authenticated user
> returns the user that is currently using the application.

Thanks, but in this case, the current user is editing the profile of
other people in my database, so that won't work.

>
> Did I get you wrong?

You got me right, but what I really want is advice about if this
strategy is wise.  Am I doing too much in the validation layer?  I
know it is technically possible, but is it wise?

Thanks for the feedback.

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