.. include:: changelog_07.rst
:start-line: 5
+.. changelog::
+ :version: 0.9.3
+
+ .. change::
+ :tags: bug, orm
+ :tickets: 2935
+
+ Improved the initialization logic of composite attributes such that
+ calling ``MyClass.attribute`` will not require that the configure
+ mappers step has occurred, e.g. it will just work without throwing
+ any error.
+
.. changelog::
:version: 0.9.2
:released: February 2, 2014
has been associated with its parent mapper.
"""
- self._init_props()
self._setup_arguments_on_columns()
def _create_descriptor(self):
for prop in self.props
]
- def _init_props(self):
- self.props = props = []
+ @util.memoized_property
+ def props(self):
+ props = []
for attr in self.attrs:
if isinstance(attr, str):
- prop = self.parent.get_property(attr)
+ prop = self.parent.get_property(attr, _configure_mappers=False)
elif isinstance(attr, schema.Column):
prop = self.parent._columntoproperty[attr]
elif isinstance(attr, attributes.InstrumentedAttribute):
"attributes/attribute names as arguments, got: %r"
% (attr,))
props.append(prop)
+ return props
@property
def columns(self):
sess.commit()
return sess
+ def test_early_configure(self):
+ # test [ticket:2935], that we can call a composite
+ # expression before configure_mappers()
+ Edge = self.classes.Edge
+ Edge.start.__clause_element__()
+
def test_round_trip(self):
Graph, Point = self.classes.Graph, self.classes.Point
})
mapper(B, b)
+ def test_early_configure(self):
+ # test [ticket:2935], that we can call a composite
+ # expression before configure_mappers()
+ A = self.classes.A
+ A.c.__clause_element__()
+
+
def test_persist(self):
A, C, B = (self.classes.A,
self.classes.C,