summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-02-12 17:28:20 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-02-12 17:28:20 -0500
commitfdc92f0226779d608a5082e2f9009a332c142eb1 (patch)
tree2d18123c41d5cb5c6cb3b4503402fc20fe524d80 /lib/sqlalchemy/orm
parent345de2ee1dfb12c6314144c2b7ed6fb4a7a3cb7c (diff)
downloadsqlalchemy-fdc92f0226779d608a5082e2f9009a332c142eb1.tar.gz
- [bug] Fixed bug whereby if a method name
conflicted with a column name, a TypeError would be raised when the mapper tried to inspect the __get__() method on the method object. [ticket:2352]
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r--lib/sqlalchemy/orm/mapper.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py
index 42acb4928..e96b7549a 100644
--- a/lib/sqlalchemy/orm/mapper.py
+++ b/lib/sqlalchemy/orm/mapper.py
@@ -1452,12 +1452,19 @@ class Mapper(object):
return result
def _is_userland_descriptor(self, obj):
- return not isinstance(obj,
- (MapperProperty, attributes.QueryableAttribute)) and \
- hasattr(obj, '__get__') and not \
- isinstance(obj.__get__(None, obj),
- attributes.QueryableAttribute)
-
+ if isinstance(obj, (MapperProperty,
+ attributes.QueryableAttribute)):
+ return False
+ elif not hasattr(obj, '__get__'):
+ return False
+ else:
+ obj = util.unbound_method_to_callable(obj)
+ if isinstance(
+ obj.__get__(None, obj),
+ attributes.QueryableAttribute
+ ):
+ return False
+ return True
def _should_exclude(self, name, assigned_name, local, column):
"""determine whether a particular property should be implicitly