Contact: fumanchu@aminus.org

Log in as guest/dejavu to create tickets

I think I've seen this ORM somewhere before...

Changeset 224

Show
Ignore:
Timestamp:
07/13/06 15:30:03
Author:
fumanchu
Message:

BACKWARD INCOMPATIBILITY: Dropped Unit.property_type(key) in favor of Unit.property(key).type

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/storage/db.py

    r223 r224  
    117117    def coerce(self, cls, key): 
    118118        """coerce(cls, key) -> SQL typename for valuetype.""" 
    119         valuetype = cls.property_type(key) 
     119        valuetype = cls.property(key).type 
    120120        mod = valuetype.__module__ 
    121121        if mod == "__builtin__": 
     
    402402    def consume(self, unit, key, value, coltype): 
    403403        try: 
    404             expectedType = unit.__class__.property_type(key) 
     404            expectedType = unit.__class__.property(key).type 
    405405            value = self.coerce(value, coltype, expectedType) 
    406406            unit._properties[key] = value 
     
    12951295            data, columns = self.fetch(sql) 
    12961296            actualTypes = [x[1] for x in columns] 
    1297             expectedTypes = [cls.property_type(x) for x in fields] 
     1297            expectedTypes = [cls.property(x).type for x in fields] 
    12981298             
    12991299            coerce = self.fromAdapter.coerce 
     
    13281328            data, columns = self.fetch(sql) 
    13291329            actualTypes = [x[1] for x in columns] 
    1330             expectedTypes = [cls.property_type(x) for x in fields] 
     1330            expectedTypes = [cls.property(x).type for x in fields] 
    13311331             
    13321332            coerce = self.fromAdapter.coerce 
  • trunk/units.py

    r223 r224  
    598598    indices = classmethod(indices) 
    599599     
    600     def property_type(cls, key): 
    601         """cls.property_type(key) -> type of the given UnitProperty.""" 
     600    def property(cls, key): 
     601        """Return the specified UnitProperty object (not its value).""" 
    602602        # Retrieving from the class gives us 
    603603        # the UnitProperty object, not its value. 
    604         return getattr(cls, key).type 
    605     property_type = classmethod(property_type
     604        return getattr(cls, key) 
     605    property = classmethod(property
    606606     
    607607    def adjust(self, **values):