From: Mike Bayer Date: Fri, 3 Sep 2010 22:01:59 +0000 (-0400) Subject: merge latest tip X-Git-Tag: rel_0_7b1~252^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=904466a29320844ccc164bad4699198d3916159d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git merge latest tip --- 904466a29320844ccc164bad4699198d3916159d diff --cc doc/build/mappers.rst index 9ae73861af,b7409647bf..bcb35e8139 --- a/doc/build/mappers.rst +++ b/doc/build/mappers.rst @@@ -318,17 -361,24 +375,23 @@@ The ``email`` attribute is now usable i other mapped attribute, including filter expressions, get/set operations, etc.:: - address = session.query(EmailAddress).filter(EmailAddress.email == 'some address').one() + address = session.query(EmailAddress).\\ + filter(EmailAddress.email == 'some address').\\ + one() address.email = 'some other address' - session.flush() - - q = session.query(EmailAddress).filter_by(email='some other address') + session.commit() -If the mapped class does not provide a property, the :func:`.synonym` construct will create a default getter/setter object automatically. + q = session.query(EmailAddress).\ + filter_by(email='some other address') -To use synonyms with :mod:`~sqlalchemy.ext.declarative`, see the section -:ref:`declarative_synonyms`. + Note that the "synonym" feature is eventually to be replaced by the superior + "hybrid attributes" approach, slated to become a built in feature of SQLAlchemy + in a future release. "hybrid" attributes are simply Python properties that evaulate + at both the class level and at the instance level. For an example of their usage, + see the :mod:`derived_attributes` example. + .. _custom_comparators: Custom Comparators diff --cc lib/sqlalchemy/orm/mapper.py index 7a92e8946f,f03dd63772..3374ea72d2 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@@ -1082,12 -1120,10 +1106,13 @@@ class Mapper(object) def _is_userland_descriptor(self, obj): return not isinstance(obj, - (MapperProperty, attributes.InstrumentedAttribute)) and \ - hasattr(obj, '__get__') + (MapperProperty, attributes.QueryableAttribute)) and \ + hasattr(obj, '__get__') and not \ + isinstance(obj.__get__(None, obj), + attributes.QueryableAttribute) + - def _should_exclude(self, name, assigned_name, local): + + def _should_exclude(self, name, assigned_name, local, column): """determine whether a particular property should be implicitly present on the class.