[Sqlalchemy-commits] [3973] sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py: cruft ! who knew
Brought to you by:
zzzeek
From: <co...@sq...> - 2007-12-21 16:58:20
|
<!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>[3973] sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py: cruft ! who knew</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>3973</dd> <dt>Author</dt> <dd>zzzeek</dd> <dt>Date</dt> <dd>2007-12-21 11:58:18 -0500 (Fri, 21 Dec 2007)</dd> </dl> <h3>Log Message</h3> <pre>cruft ! who knew</pre> <h3>Modified Paths</h3> <ul> <li><a href="#sqlalchemytrunklibsqlalchemyormmapperpy">sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="sqlalchemytrunklibsqlalchemyormmapperpy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py (3972 => 3973)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py 2007-12-21 16:44:12 UTC (rev 3972) +++ sqlalchemy/trunk/lib/sqlalchemy/orm/mapper.py 2007-12-21 16:58:18 UTC (rev 3973) </span><span class="lines">@@ -347,7 +347,7 @@ </span><span class="cx"> self._synchronizer = None </span><span class="cx"> self.mapped_table = self.local_table </span><span class="cx"> if self.polymorphic_identity is not None: </span><del>- self.inherits._add_polymorphic_mapping(self.polymorphic_identity, self) </del><ins>+ self.inherits.polymorphic_map[self.polymorphic_identity] = self </ins><span class="cx"> if self.polymorphic_on is None: </span><span class="cx"> if self.inherits.polymorphic_on is not None: </span><span class="cx"> self.polymorphic_on = self.mapped_table.corresponding_column(self.inherits.polymorphic_on) </span><span class="lines">@@ -377,24 +377,12 @@ </span><span class="cx"> if self.polymorphic_identity is not None: </span><span class="cx"> if self.polymorphic_on is None: </span><span class="cx"> raise exceptions.ArgumentError("Mapper '%s' specifies a polymorphic_identity of '%s', but no mapper in it's hierarchy specifies the 'polymorphic_on' column argument" % (str(self), self.polymorphic_identity)) </span><del>- self._add_polymorphic_mapping(self.polymorphic_identity, self) </del><ins>+ self.polymorphic_map[self.polymorphic_identity] = self </ins><span class="cx"> self._identity_class = self.class_ </span><span class="cx"> </span><span class="cx"> if self.mapped_table is None: </span><span class="cx"> raise exceptions.ArgumentError("Mapper '%s' does not have a mapped_table specified. (Are you using the return value of table.create()? It no longer has a return value.)" % str(self)) </span><span class="cx"> </span><del>- # convert polymorphic class associations to mappers - for key in self.polymorphic_map.keys(): - if isinstance(self.polymorphic_map[key], type): - self.polymorphic_map[key] = class_mapper(self.polymorphic_map[key]) - - def _add_polymorphic_mapping(self, key, class_or_mapper, entity_name=None): - """Add a Mapper to our *polymorphic map*.""" - - if isinstance(class_or_mapper, type): - class_or_mapper = class_mapper(class_or_mapper, entity_name=entity_name) - self.polymorphic_map[key] = class_or_mapper - </del><span class="cx"> def _compile_tables(self): </span><span class="cx"> # summary of the various Selectable units: </span><span class="cx"> # mapped_table - the Selectable that represents a join of the underlying Tables to be saved (or just the Table) </span><span class="lines">@@ -569,6 +557,7 @@ </span><span class="cx"> </span><span class="cx"> class _CompileOnAttr(PropComparator): </span><span class="cx"> """placeholder class attribute which fires mapper compilation on access""" </span><ins>+ </ins><span class="cx"> def __init__(self, class_, key): </span><span class="cx"> self.class_ = class_ </span><span class="cx"> self.key = key </span></span></pre> </div> </div> </body> </html> |