[Sqlalchemy-commits] [5065] sqlalchemy/trunk: - Fixed bug whereby deferred() columns with a group i
Brought to you by:
zzzeek
From: <co...@sq...> - 2008-08-28 17:11:25
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[5065] sqlalchemy/trunk: - Fixed bug whereby deferred() columns with a group in conjunction</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>5065</dd> <dt>Author</dt> <dd>zzzeek</dd> <dt>Date</dt> <dd>2008-08-28 13:11:18 -0400 (Thu, 28 Aug 2008)</dd> </dl> <h3>Log Message</h3> <pre>- Fixed bug whereby deferred() columns with a group in conjunction with an otherwise unrelated synonym() would produce an AttributeError during deferred load.</pre> <h3>Modified Paths</h3> <ul> <li><a href="#sqlalchemytrunkCHANGES">sqlalchemy/trunk/CHANGES</a></li> <li><a href="#sqlalchemytrunklibsqlalchemyormstrategiespy">sqlalchemy/trunk/lib/sqlalchemy/orm/strategies.py</a></li> <li><a href="#sqlalchemytrunktestormmapperpy">sqlalchemy/trunk/test/orm/mapper.py</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="sqlalchemytrunkCHANGES"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/CHANGES (5064 => 5065)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/CHANGES 2008-08-28 14:21:07 UTC (rev 5064) +++ sqlalchemy/trunk/CHANGES 2008-08-28 17:11:18 UTC (rev 5065) </span><span class="lines">@@ -39,6 +39,10 @@ </span><span class="cx"> - Fixed primary key update for many-to-many collections where </span><span class="cx"> the collection had not been loaded yet [ticket:1127] </span><span class="cx"> </span><ins>+ - Fixed bug whereby deferred() columns with a group in conjunction + with an otherwise unrelated synonym() would produce + an AttributeError during deferred load. + </ins><span class="cx"> - The before_flush() hook on SessionExtension takes place before </span><span class="cx"> the list of new/dirty/deleted is calculated for the final </span><span class="cx"> time, allowing routines within before_flush() to further </span></span></pre></div> <a id="sqlalchemytrunklibsqlalchemyormstrategiespy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/lib/sqlalchemy/orm/strategies.py (5064 => 5065)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/lib/sqlalchemy/orm/strategies.py 2008-08-28 14:21:07 UTC (rev 5064) +++ sqlalchemy/trunk/lib/sqlalchemy/orm/strategies.py 2008-08-28 17:11:18 UTC (rev 5065) </span><span class="lines">@@ -13,7 +13,7 @@ </span><span class="cx"> from sqlalchemy.orm import mapper, attributes </span><span class="cx"> from sqlalchemy.orm.interfaces import ( </span><span class="cx"> LoaderStrategy, StrategizedOption, MapperOption, PropertyOption, </span><del>- serialize_path, deserialize_path </del><ins>+ serialize_path, deserialize_path, StrategizedProperty </ins><span class="cx"> ) </span><span class="cx"> from sqlalchemy.orm import session as sessionlib </span><span class="cx"> from sqlalchemy.orm import util as mapperutil </span><span class="lines">@@ -247,7 +247,13 @@ </span><span class="cx"> if self.keys: </span><span class="cx"> toload = self.keys </span><span class="cx"> elif strategy.group: </span><del>- toload = [p.key for p in localparent.iterate_properties if isinstance(p.strategy, DeferredColumnLoader) and p.group==strategy.group] </del><ins>+ toload = [ + p.key for p in + localparent.iterate_properties + if isinstance(p, StrategizedProperty) and + isinstance(p.strategy, DeferredColumnLoader) and + p.group==strategy.group + ] </ins><span class="cx"> else: </span><span class="cx"> toload = [self.key] </span><span class="cx"> </span></span></pre></div> <a id="sqlalchemytrunktestormmapperpy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/test/orm/mapper.py (5064 => 5065)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/test/orm/mapper.py 2008-08-28 14:21:07 UTC (rev 5064) +++ sqlalchemy/trunk/test/orm/mapper.py 2008-08-28 17:11:18 UTC (rev 5065) </span><span class="lines">@@ -1144,6 +1144,17 @@ </span><span class="cx"> self.sql_count_(0, go) </span><span class="cx"> </span><span class="cx"> @testing.resolve_artifact_names </span><ins>+ def test_synonym_group_bug(self): + mapper(Order, orders, properties={ + 'isopen':synonym('_isopen', map_column=True), + 'description':deferred(orders.c.description, group='foo') + }) + + sess = create_session() + o1 = sess.query(Order).get(1) + eq_(o1.description, "order 1") + + @testing.resolve_artifact_names </ins><span class="cx"> def test_unsaved_2(self): </span><span class="cx"> mapper(Order, orders, properties={ </span><span class="cx"> 'description': deferred(orders.c.description)}) </span></span></pre> </div> </div> </body> </html> |