On Sat, 2007-06-09 at 22:13 +0000, Christopher wrote:
> Is there a way that I can do something like this in Python?
>
> try:
> # Do something
> except not MyModel.DoesNotExist:
> # Handle it...
>
> I want to handle all exception except if it's a DoesNotExist one.
> Then I don't care.
This will work:
try:
#...
except Exception, e:
if isinstance(e, MyModel.DoesNotExist):
raise # (or whatever you like)
# ...
Regards,
Malcolm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---