concept of relations on a mapper being made towards the "local" table for that
mapper, not the tables it inherits. allows more complex compositional patterns
to work with lazy/eager loading.
+- added support for mappers to inherit from others based on the same table,
+just specify the same table as that of both parent/child mapper.
- some minor speed improvements to the attributes system with regards to
instantiating and populating new objects.
- fixed MySQL binary unit test
if inherits is not None:
self.primarytable = inherits.primarytable
# inherit_condition is optional.
- if inherit_condition is None:
- # figure out inherit condition from our table to the immediate table
- # of the inherited mapper, not its full table which could pull in other
- # stuff we dont want (allows test/inheritance.InheritTest4 to pass)
- inherit_condition = sql.join(inherits.noninherited_table, table).onclause
- self.table = sql.join(inherits.table, table, inherit_condition)
- #print "inherit condition", str(self.table.onclause)
-
- # generate sync rules. similarly to creating the on clause, specify a
- # stricter set of tables to create "sync rules" by,based on the immediate
- # inherited table, rather than all inherited tables
- self._synchronizer = sync.ClauseSynchronizer(self, self, sync.ONETOMANY)
- self._synchronizer.compile(self.table.onclause, util.HashSet([inherits.noninherited_table]), TableFinder(table))
- # the old rule
- #self._synchronizer.compile(self.table.onclause, inherits.tables, TableFinder(table))
+ if not table is inherits.noninherited_table:
+ if inherit_condition is None:
+ # figure out inherit condition from our table to the immediate table
+ # of the inherited mapper, not its full table which could pull in other
+ # stuff we dont want (allows test/inheritance.InheritTest4 to pass)
+ inherit_condition = sql.join(inherits.noninherited_table, table).onclause
+ self.table = sql.join(inherits.table, table, inherit_condition)
+ #print "inherit condition", str(self.table.onclause)
+ # generate sync rules. similarly to creating the on clause, specify a
+ # stricter set of tables to create "sync rules" by,based on the immediate
+ # inherited table, rather than all inherited tables
+ self._synchronizer = sync.ClauseSynchronizer(self, self, sync.ONETOMANY)
+ self._synchronizer.compile(self.table.onclause, util.HashSet([inherits.noninherited_table]), TableFinder(table))
+ # the old rule
+ #self._synchronizer.compile(self.table.onclause, inherits.tables, TableFinder(table))
+ else:
+ self._synchronizer = None
self.inherits = inherits
self.noninherited_table = table
else: