diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-08-13 19:20:44 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-08-13 19:20:44 -0400 |
| commit | ea85c7053dc9532a95fd487628768fdfc1ca5c30 (patch) | |
| tree | cb4daf1166a5ef4a6dcf4d3c05da1a97882233df /lib/sqlalchemy | |
| parent | 44d21de457424f5623362474325aa6e5d3fe9e6d (diff) | |
| download | sqlalchemy-ea85c7053dc9532a95fd487628768fdfc1ca5c30.tar.gz | |
- The :meth:`.InspectionAttr.info` collection is now moved down to
:class:`.InspectionAttr`, where in addition to being available
on all :class:`.MapperProperty` objects, it is also now available
on hybrid properties, association proxies, when accessed via
:attr:`.Mapper.all_orm_descriptors`.
fixes #2971
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/orm/base.py | 26 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/interfaces.py | 22 |
2 files changed, 26 insertions, 22 deletions
diff --git a/lib/sqlalchemy/orm/base.py b/lib/sqlalchemy/orm/base.py index 3097b8590..3390ceec4 100644 --- a/lib/sqlalchemy/orm/base.py +++ b/lib/sqlalchemy/orm/base.py @@ -488,6 +488,32 @@ class InspectionAttr(object): """ + @util.memoized_property + def info(self): + """Info dictionary associated with the object, allowing user-defined + data to be associated with this :class:`.InspectionAttr`. + + The dictionary is generated when first accessed. Alternatively, + it can be specified as a constructor argument to the + :func:`.column_property`, :func:`.relationship`, or :func:`.composite` + functions. + + .. versionadded:: 0.8 Added support for .info to all + :class:`.MapperProperty` subclasses. + + .. versionchanged:: 1.0.0 :attr:`.InspectionAttr.info` moved + from :class:`.MapperProperty` so that it can apply to a wider + variety of ORM and extension constructs. + + .. seealso:: + + :attr:`.QueryableAttribute.info` + + :attr:`.SchemaItem.info` + + """ + return {} + class _MappedAttribute(object): """Mixin for attributes which should be replaced by mapper-assigned diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py index 2dfaf6243..49ec99ce4 100644 --- a/lib/sqlalchemy/orm/interfaces.py +++ b/lib/sqlalchemy/orm/interfaces.py @@ -109,28 +109,6 @@ class MapperProperty(_MappedAttribute, InspectionAttr): def instrument_class(self, mapper): # pragma: no-coverage raise NotImplementedError() - @util.memoized_property - def info(self): - """Info dictionary associated with the object, allowing user-defined - data to be associated with this :class:`.MapperProperty`. - - The dictionary is generated when first accessed. Alternatively, - it can be specified as a constructor argument to the - :func:`.column_property`, :func:`.relationship`, or :func:`.composite` - functions. - - .. versionadded:: 0.8 Added support for .info to all - :class:`.MapperProperty` subclasses. - - .. seealso:: - - :attr:`.QueryableAttribute.info` - - :attr:`.SchemaItem.info` - - """ - return {} - _configure_started = False _configure_finished = False |
