Changeset 335

Show
Ignore:
Timestamp:
05/21/08 16:55:48 (5 years ago)
Author:
cleverdevil
Message:

The to_dict method on Entity was not looking for columns in the case of multi-table inheritance. Now, the columns to be included in the to_dict are copied from the mapper.tables list.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • elixir/trunk/elixir/entity.py

    r333 r335  
    932932    def to_dict(self, deep={}, exclude=[]): 
    933933        """Generate a JSON-style nested dict/list structure from an object.""" 
     934        columns = [] 
     935        for table in self.mapper.tables: 
     936            for col in table.c: 
     937                columns.append(col) 
     938             
    934939        data = dict([(col.name, getattr(self, col.name)) 
    935                      for col in self.table.c if col.name not in exclude]) 
     940                     for col in columns if col.name not in exclude]) 
    936941        for rname, rdeep in deep.iteritems(): 
    937942            dbdata = getattr(self, rname)