From: Mike Bayer Date: Wed, 25 Aug 2010 16:57:10 +0000 (-0400) Subject: - hybrid_and X-Git-Tag: rel_0_7b1~252^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65a6e97906802237228ea359f33bb33f1ad4a2f9;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - hybrid_and - move the update_wrapper to synonym for now, we can't assume the return value of hybrid.expr is an updateable wrapper --- diff --git a/lib/sqlalchemy/ext/hybrid.py b/lib/sqlalchemy/ext/hybrid.py index 609f5aa8e5..e0b3dab483 100644 --- a/lib/sqlalchemy/ext/hybrid.py +++ b/lib/sqlalchemy/ext/hybrid.py @@ -90,7 +90,7 @@ class property_(object): def __get__(self, instance, owner): if instance is None: - return util.update_wrapper(self.expr(owner), self) + return self.expr(owner) else: return self.fget(instance) @@ -135,6 +135,9 @@ class Comparator(interfaces.PropComparator): # interesting.... return self - - - \ No newline at end of file + +def hybrid_and(self): + if isinstance(self, type): + return expression.and_ + else: + return operator.and_ diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py index e6afe8d634..61b7f8c192 100644 --- a/lib/sqlalchemy/orm/properties.py +++ b/lib/sqlalchemy/orm/properties.py @@ -292,7 +292,7 @@ class DescriptorProperty(MapperProperty): lambda: self._comparator_factory(mapper) ) def get_comparator(owner): - return proxy_attr + return util.update_wrapper(proxy_attr, descriptor) descriptor.expr = get_comparator descriptor.impl = _ProxyImpl(self.key) mapper.class_manager.instrument_attribute(self.key, descriptor)