Exemple #1
0
    def _resolve_key(self, raw):
        if is_string_like(raw):
            key = raw

        elif isinstance(raw, values.ConfigurationGroup):
            key = raw.key

        else:
            group = self.groups()[raw]
            key = group.key

        return key
        def _resolve_key(self, raw):
            if is_string_like(raw):
                key = raw

            elif isinstance(raw, values.ConfigurationGroup):
                key = raw.key

            else:
                group = self.groups()[raw]
                key = group.key

            return key
Exemple #3
0
 def to_python(self, value):
     if not value or value == NOTSET:
         return []
     if is_list_or_tuple(value):
         return value
     else:
         try:
             return simplejson.loads(value)
         except (simplejson.JSONDecodeError, TypeError):
             if is_string_like(value):
                 return [value]
             else:
                 raise ValueError("Could not decode value: %r" % value)
 def to_python(self, value):
     if not value or value == NOTSET:
         return []
     if is_list_or_tuple(value):
         return value
     else:
         try:
             return simplejson.loads(value)
         except (simplejson.JSONDecodeError, TypeError):
             if is_string_like(value):
                 return [value]
             else:
                 raise ValueError("Could not decode value: %r" % value)
 def to_python(self, value):
     if not value or value == NOTSET:
         return []
     if is_list_or_tuple(value):
         return value
     else:
         try:
             return json.loads(value)
         except:
             if is_string_like(value):
                 return [value]
             else:
                 log.warning('Could not decode returning empty list: %s', value)
                 return []
Exemple #6
0
 def to_python(self, value):
     if not value or value == NOTSET:
         return []
     if is_list_or_tuple(value):
         return value
     else:
         try:
             return json.loads(value)
         except:
             if is_string_like(value):
                 return [value]
             else:
                 logger.warning('Could not decode returning empty list: %s', value)
                 return []
 def get_db_prep_save(self, value):
     if is_string_like(value):
         value = [value]
     return json.dumps(value)
 def get_db_prep_save(self, value):
     if is_string_like(value):
         value = [value]
     return json.dumps(value)