diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-07-31 17:32:07 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-07-31 17:32:07 -0400 |
| commit | 1a0c8ace3010d9d7bcfd651d4bb1340b83b3850b (patch) | |
| tree | 8a7d6dd2ee174c7893e77e7be2d4764ba816c57e /lib/sqlalchemy/orm/exc.py | |
| parent | f948fa0fb0c73d01077d65b1b8103c12282ff020 (diff) | |
| download | sqlalchemy-1a0c8ace3010d9d7bcfd651d4bb1340b83b3850b.tar.gz | |
- Load of a deferred() attribute on an object
where row can't be located raises
ObjectDeletedError instead of failing later
on; improved the message in ObjectDeletedError
to include other conditions besides a simple
"delete". [ticket:2191]
- break up test_get_refreshes() in test_expire
Diffstat (limited to 'lib/sqlalchemy/orm/exc.py')
| -rw-r--r-- | lib/sqlalchemy/orm/exc.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/exc.py b/lib/sqlalchemy/orm/exc.py index 1812f0d72..98b97059e 100644 --- a/lib/sqlalchemy/orm/exc.py +++ b/lib/sqlalchemy/orm/exc.py @@ -7,7 +7,7 @@ """SQLAlchemy ORM exceptions.""" import sqlalchemy as sa - +orm_util = sa.util.importlater('sqlalchemy.orm', 'util') NO_STATE = (AttributeError, KeyError) """Exception types that may be raised by instrumentation implementations.""" @@ -95,7 +95,12 @@ class ObjectDeletedError(sa.exc.InvalidRequestError): object. """ - + def __init__(self, state): + sa.exc.InvalidRequestError.__init__( + self, + "Instance '%s' has been deleted, or its " + "row is otherwise not present." % orm_util.state_str(state) + ) class UnmappedColumnError(sa.exc.InvalidRequestError): """Mapping operation was requested on an unknown column.""" |
