def to_dict(self):
    output = {}
    for (key, prop) in self.properties().iteritems():
        value = getattr(self, key)
        if ((value is None) or isinstance(value, SIMPLE_TYPES)):
            output[key] = value
        elif isinstance(value, datetime.date):
            output[key] = unicode(value)
        elif isinstance(value, db.GeoPt):
            output[key] = {'lat': value.lat, 'lon': value.lon}
        elif isinstance(value, db.Model):
            output[key] = to_dict(value)
        elif isinstance(value, users.User):
            output[key] = value.email()
        else:
            raise ValueError(('cannot encode ' + repr(prop)))
    return output
def to_dict(self):
    output = {}
    for (key, prop) in self.properties().iteritems():
        value = getattr(self, key)
        if ((value is None) or isinstance(value, SIMPLE_TYPES)):
            output[key] = value
        elif isinstance(value, datetime.date):
            output[key] = unicode(value)
        elif isinstance(value, db.GeoPt):
            output[key] = {'lat': value.lat, 'lon': value.lon}
        elif isinstance(value, db.Model):
            output[key] = to_dict(value)
        elif isinstance(value, users.User):
            output[key] = value.email()
        else:
            raise ValueError(('cannot encode ' + repr(prop)))
    return output