summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/build/changelog/changelog_08.rst8
-rw-r--r--lib/sqlalchemy/orm/interfaces.py2
2 files changed, 9 insertions, 1 deletions
diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst
index 8df055e10..13c044351 100644
--- a/doc/build/changelog/changelog_08.rst
+++ b/doc/build/changelog/changelog_08.rst
@@ -7,6 +7,14 @@
:version: 0.8.1
.. change::
+ :tags: bug, orm
+
+ Fixed `__repr__()` on mapper property constructs
+ to work before the object is initialized, so
+ that Sphinx builds with recent Sphinx versions
+ can read them.
+
+ .. change::
:tags: bug, sql, postgresql
The _Binary base type now converts values through
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py
index 62cdb2710..70743624c 100644
--- a/lib/sqlalchemy/orm/interfaces.py
+++ b/lib/sqlalchemy/orm/interfaces.py
@@ -289,7 +289,7 @@ class MapperProperty(_MappedAttribute, _InspectionAttr):
def __repr__(self):
return '<%s at 0x%x; %s>' % (
self.__class__.__name__,
- id(self), self.key)
+ id(self), getattr(self, 'key', 'no key'))
class PropComparator(operators.ColumnOperators):
"""Defines boolean, comparison, and other operators for