"Jorge Vargas" <[EMAIL PROTECTED]> writes:

> which leads us to
>
>      def defineActivity(self, name):
>          try:
>              result = Activity(name=name)
>          except SQLObjectNotFound:
>              result = Activity.byName(name)
>          return result

This doesn't look right to me...  If you *create* (aka INSERT) a record, how
will it return SQLObjectNotFound?  It should return that on a SELECT (get,
by*, select, etc.)... 

You probably want it reversed.

>> >         result = Activity.byName(name)
>> >         if result is None:
>> >             result = Activity(name=name)
>> >         return result
>
>
> that works but your just working around the exception mecanism... going back
> to what was before and in computers you normally don't want to do that :)

I didn't get your comment, Jorge.  He's not work arounding any exception here:
if one exception is raised, then the program will let it propagate without any
problem.  He's just checking if there's some return or not and then dealing
with it...


-- 
Jorge Godoy      <[EMAIL PROTECTED]>

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