0

I need save EXIF data to couchdb. This is a dictionary of different variable types (str, list, int ...). Lists can have inside different types too. I have problem with storing Tuple to couchdbkit. This type is no present inside ALLOWED_PROPERTY_TYPES

Oleh Herych
  • 897
  • 1
  • 9
  • 16

1 Answers1

0

I prepared recursive function for replace all tuple to list:

def _tuple_to_list(self, el):

    if type(el) is tuple:
        el = self._tuple_to_list(list(el))
    elif type(el) is dict:
        for (key, value) in el.items():
            el[key] = self._tuple_to_list(value)
    elif type(el) is list:
        for i in range(len(el)):
            el[i] = self._tuple_to_list(el[i])

    return el
Oleh Herych
  • 897
  • 1
  • 9
  • 16