summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-08-04 18:11:18 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-08-04 18:11:18 -0400
commit79f26dbff98a3e5625c94fbea5bfb35a2d7016cf (patch)
tree0e0d83363e2843f71cdf227b585e8ec97a5361fc /lib/sqlalchemy
parentb99480aac23fdd4e0ef3633703ca5b32ea49805a (diff)
downloadsqlalchemy-79f26dbff98a3e5625c94fbea5bfb35a2d7016cf.tar.gz
- [feature] Can now provide class-bound attributes
that override columns which are of any non-ORM type, not just descriptors. [ticket:2535]
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/mapper.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py
index 0254933c2..a1d3d6954 100644
--- a/lib/sqlalchemy/orm/mapper.py
+++ b/lib/sqlalchemy/orm/mapper.py
@@ -1630,18 +1630,12 @@ class Mapper(_InspectionAttr):
def _is_userland_descriptor(self, obj):
if isinstance(obj, (MapperProperty,
- attributes.QueryableAttribute)):
- return False
- elif not hasattr(obj, '__get__'):
+ attributes.QueryableAttribute,
+ instrumentation.ClassManager,
+ expression.ColumnElement)):
return False
else:
- obj = util.unbound_method_to_callable(obj)
- if isinstance(
- obj.__get__(None, obj),
- attributes.QueryableAttribute
- ):
- return False
- return True
+ return True
def _should_exclude(self, name, assigned_name, local, column):
"""determine whether a particular property should be implicitly
@@ -1652,8 +1646,8 @@ class Mapper(_InspectionAttr):
"""
- # check for descriptors, either local or from
- # an inherited class
+ # check for class-bound attributes and/or descriptors,
+ # either local or from an inherited class
if local:
if self.class_.__dict__.get(assigned_name, None) is not None \
and self._is_userland_descriptor(