From: Mike Bayer Date: Thu, 11 Apr 2013 23:37:56 +0000 (-0400) Subject: Fixed `__repr__()` on mapper property constructs X-Git-Tag: rel_0_8_1~16^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e2bfaf769c429021d5ab6716f2fcdcd327c2627;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Fixed `__repr__()` on mapper property constructs to work before the object is initialized, so that Sphinx builds with recent Sphinx versions can read them. --- diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst index 8df055e10f..13c044351c 100644 --- a/doc/build/changelog/changelog_08.rst +++ b/doc/build/changelog/changelog_08.rst @@ -6,6 +6,14 @@ .. changelog:: :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 diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py index 62cdb27107..70743624ce 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