38 | | value = field._get_val_from_obj(obj) |
39 | | # Protected types (i.e., primitives like None, numbers, dates, |
40 | | # and Decimals) are passed through as is. All other values are |
41 | | # converted to string first. |
42 | | if is_protected_type(value): |
43 | | self._current[field.name] = value |
44 | | else: |
45 | | self._current[field.name] = field.value_to_string(obj) |
| 38 | try: |
| 39 | value = field._get_val_from_obj(obj) |
| 40 | # Protected types (i.e., primitives like None, numbers, dates, |
| 41 | # and Decimals) are passed through as is. All other values are |
| 42 | # converted to string first. |
| 43 | if is_protected_type(value): |
| 44 | self._current[field.name] = value |
| 45 | else: |
| 46 | self._current[field.name] = field.value_to_string(obj) |
| 47 | except AttributeError: |
| 48 | self._current[field.name] = smart_unicode(getattr(obj, field.name), |
| 49 | strings_only=True) |