def end_object( self, obj ): if(self.selected_fields ): for field_name in self.selected_fields: if self._current.has_key(field_name):continue try: o = obj for attr in field_name.split("."): o = getattr(o, attr) if callable(o): o = o() field_name = field_name.replace(".", "_") self._current[field_name] = smart_unicode(o, strings_only=True) except: field_name = field_name.replace(".", "_") self._current[field_name] = None BuitlInJsonSerializer.end_object(self, obj)
def end_object(self, obj): if (self.selected_fields): for field_name in self.selected_fields: if self._current.has_key(field_name): continue try: o = obj for attr in field_name.split("."): o = getattr(o, attr) if callable(o): o = o() field_name = field_name.replace(".", "_") if type(o) not in [types.ListType, types.DictType]: self._current[field_name] = smart_unicode( o, strings_only=True) else: self._current[field_name] = o except: field_name = field_name.replace(".", "_") self._current[field_name] = None BuitlInJsonSerializer.end_object(self, obj)