I don't know about simpler, but this code will at least keep you from
grabbing exceptions you don't want:

try:
   var1 = User.by_user_name(userString)
except SQLObjectNotFound:
   var1 = None

You could also add your own method to the user class that returns
either the user name or none, if you plan on using the above idiom a
whole lot.

-Adam


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

Reply via email to