summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-10-01 16:34:50 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2018-10-01 16:35:27 -0400
commitb171a2ed0351aff755c34ca9cf51e8e33c2df95e (patch)
tree6e07f331c026fea971f9256f0f8a6534d568a96f /lib
parent29d54ab69b689c2bc4b9be8273f4c0a96e37153f (diff)
downloadsqlalchemy-b171a2ed0351aff755c34ca9cf51e8e33c2df95e.tar.gz
Add .info to InstanceState
Added ``.info`` dictionary to the :class:`.InstanceState` class, the object that comes from calling :func:`.inspect` on a mapped object. Fixes: #4257 Change-Id: I32d043f369edb708a17eec2e0b8876db0c1891b4
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/state.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/state.py b/lib/sqlalchemy/orm/state.py
index 03d68ab82..935e7df19 100644
--- a/lib/sqlalchemy/orm/state.py
+++ b/lib/sqlalchemy/orm/state.py
@@ -24,7 +24,7 @@ from . import base
@inspection._self_inspects
-class InstanceState(interfaces.InspectionAttr):
+class InstanceState(interfaces.InspectionAttrInfo):
"""tracks state information at the instance level.
The :class:`.InstanceState` is a key object used by the
@@ -440,7 +440,7 @@ class InstanceState(interfaces.InspectionAttr):
(k, self.__dict__[k]) for k in (
'committed_state', '_pending_mutations', 'modified',
'expired', 'callables', 'key', 'parents', 'load_options',
- 'class_', 'expired_attributes'
+ 'class_', 'expired_attributes', 'info'
) if k in self.__dict__
)
if self.load_path:
@@ -467,6 +467,8 @@ class InstanceState(interfaces.InspectionAttr):
self.parents = state_dict.get('parents', {})
self.modified = state_dict.get('modified', False)
self.expired = state_dict.get('expired', False)
+ if 'info' in state_dict:
+ self.info.update(state_dict['info'])
if 'callables' in state_dict:
self.callables = state_dict['callables']