Exemplo n.º 1
0
 def _get_message(self, message):
     if isinstance(message, ValidationError):
         return message.message
     elif isinstance(message, Exception):
         return text_type(message)
     elif isinstance(message, list):
         message_list = []
         for item in message:
             extracted = self._get_message(item)
             if isinstance(extracted, list):
                 message_list.extend(extracted)
             else:
                 message_list.append(extracted)
         return message_list
     elif isinstance(message, dict):
         return {key: self._get_message(message[key]) for key in message}
     return message
Exemplo n.º 2
0
 def to_python(self, value):
     return text_type(value)
Exemplo n.º 3
0
 def __str__(self):
     return text_type(self.message)
Exemplo n.º 4
0
 def to_python(self, value):
     return text_type(value)