Delay description association proxy construction

Association proxies cannot be constructed in the mixin because they
will be shared between all models that inherit from it. This means
they all share one and it will effectively be broken for all but the
first to load it.

This changes it to a declared attr like the others to make sure it's
not constructed until each model inherits from it.

Change-Id: I3e1aa21cd02c0f116cc6dee5e0577988ec37f767
Closes-Bug: #1553689
This commit is contained in:
Kevin Benton 2016-03-06 02:24:14 -08:00
parent 8a9b514c0a
commit 284f507ada
1 changed files with 3 additions and 1 deletions

View File

@ -138,4 +138,6 @@ class HasStandardAttributes(object):
self.standard_attr = StandardAttribute(
resource_type=self.__tablename__, description=description)
description = association_proxy('standard_attr', 'description')
@declarative.declared_attr
def description(cls):
return association_proxy('standard_attr', 'description')