Gerhard Häring <[EMAIL PROTECTED]> writes:

> I'd really like to have a way to write this in a more straightforward 
> fashion, because I need to catch certain database exceptions like 
> constraint violations.

That's what I'm catching, plus some custom exceptions I raise on certain
conditions *inside* the database (some triggers or functions).

> Maybe ideally using something like:
>
> try:
>    ...
> except hub.IntegrityError, e:
>    ...

I'd be happy with hub.module.IntegrityError, to avoid polluting even more what
gets into the hub namespace...  But, definitely, not a big solution as we
found.

Now I do something like:

    driver = model.hub.getConnection()._dbConnection.module

    ...

    try:
        ...
    except driver.IntegrityError, e:
        ...


This shortens it a bit on usage, but was hard to find :-)  Something easier
would be very good and incentivate people to trap their exceptions more
frequently. :-)

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