Changeset 274

Show
Ignore:
Timestamp:
12/04/07 10:36:20 (6 years ago)
Author:
ged
Message:

Fixed associable to work with SQLAlchemy trunk (future 0.4.2).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • elixir/trunk/elixir/ext/associable.py

    r267 r274  
    188188         
    189189            entity = self.entity 
     190            print "adding property", attr_name 
    190191            entity.mapper.add_property( 
    191192                attr_name,  
     
    194195            ) 
    195196 
    196             # this is strange! self.name is both set via mapper synonym and  
    197             # the python property 
    198             entity.mapper.add_property(self.name, sa.orm.synonym(attr_name)) 
    199  
    200197            if self.uselist: 
    201198                def get(self): 
     199                    print "prop_get" 
    202200                    if getattr(self, attr_name) is None: 
    203201                        setattr(self, attr_name,  
     
    220218                setattr(entity, self.name, property(get, set)) 
    221219 
     220            # self.name is both set via mapper synonym and the python  
     221            # property, but that's how synonym properties work. 
     222            # adding synonym property after "real" property otherwise it  
     223            # breaks when using SQLAlchemy > 0.4.1 
     224            entity.mapper.add_property(self.name, sa.orm.synonym(attr_name)) 
     225 
    222226            # add helper methods 
    223227            def select_by(cls, **kwargs):