Exemplo n.º 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
Exemplo n.º 2
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
Exemplo n.º 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:
             if is_string_like(value):
                 return [value]
             else:
                 log.warning('Could not decode returning empty list: %s', value)
                 return []
Exemplo n.º 4
0
 def get_db_prep_save(self, value):
     if is_string_like(value):
         value = [value]
     return simplejson.dumps(value)