summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/declarative/api.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-03-21 09:59:46 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2018-03-21 13:08:19 -0400
commit37955a52995cdbb66a9d5835c20ee58fb98ddffc (patch)
treef39efcfeb9541bb242e512c93398765e59a6cab6 /lib/sqlalchemy/ext/declarative/api.py
parent0fd508ad32a6f94653757a5ae10c1eae14e099fc (diff)
downloadsqlalchemy-37955a52995cdbb66a9d5835c20ee58fb98ddffc.tar.gz
Don't warn for mixin-based __table_args__, __mapper_args__ declared_attr
Removed a warning that would be emitted when calling upon ``__table_args__``, ``__mapper_args__`` as named with a ``@declared_attr`` method, when called from a non-mapped declarative mixin. Calling these directly is documented as the approach to use when one is overidding one of these methods on a mapped class. The warning still emits for regular attribute names. Change-Id: Iae7ed0bd625a2c163c910aa777cef4779128580a Fixes: #4221
Diffstat (limited to 'lib/sqlalchemy/ext/declarative/api.py')
-rw-r--r--lib/sqlalchemy/ext/declarative/api.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ext/declarative/api.py b/lib/sqlalchemy/ext/declarative/api.py
index 77a03bc4a..b08d3ce30 100644
--- a/lib/sqlalchemy/ext/declarative/api.py
+++ b/lib/sqlalchemy/ext/declarative/api.py
@@ -17,6 +17,7 @@ from ...util import OrderedDict, hybridmethod, hybridproperty
from ... import util
from ... import exc
import weakref
+import re
from .base import _as_declarative, \
_declarative_constructor,\
@@ -189,8 +190,8 @@ class declared_attr(interfaces._MappedAttribute, property):
def __get__(desc, self, cls):
reg = cls.__dict__.get('_sa_declared_attr_reg', None)
if reg is None:
- manager = attributes.manager_of_class(cls)
- if manager is None:
+ if not re.match(r'^__.+__$', desc.fget.__name__) and \
+ attributes.manager_of_class(cls) is None:
util.warn(
"Unmanaged access of declarative attribute %s from "
"non-mapped class %s" %