app/soc/models/base.py
changeset 1213 365b4a2df40d
parent 1032 ed83d42d1ed7
child 1307 091a21cf3627
equal deleted inserted replaced
1212:1b64b5922227 1213:365b4a2df40d
    51   def toDict(self):
    51   def toDict(self):
    52     """Returns a dict with all StringProperty values of this entity.
    52     """Returns a dict with all StringProperty values of this entity.
    53     """
    53     """
    54 
    54 
    55     result = {}
    55     result = {}
       
    56     props = self.properties()
    56 
    57 
    57     for key, value in self.properties().iteritems():
    58     for key, value in props.iteritems():
    58       # Skip everything but StringProperties
    59       # Skip everything but StringProperties
    59       if not isinstance(value, db.StringProperty):
    60       if not isinstance(value, db.StringProperty):
    60         continue
    61         continue
    61       result[key] = getattr(self, key)
    62       result[key] = getattr(self, key)
       
    63 
       
    64     if hasattr(self, 'name'):
       
    65       name_prop = getattr(self, 'name')
       
    66       if callable(name_prop):
       
    67         result['name'] = name_prop()
    62 
    68 
    63     return result
    69     return result
    64 
    70 
    65   @classmethod
    71   @classmethod
    66   def fields(cls):
    72   def fields(cls):