def _encode_value(self, value): if value is True: return 'true' elif value is False: return 'false' elif isinstance(value, int) or isinstance(value, float): value = value.__str__() else: assert isinstance(value, basestring), 'Desktop files can not store complex data' return json.dumps(value)[1:-1] # get rid of quotes
def _encode_value(self, value): if value is None: return '' elif value is True: return 'true' elif value is False: return 'false' elif isinstance(value, int) or isinstance(value, float): return value.__str__() elif isinstance(value, File): return value.path # Icon can be file else: assert isinstance(value, basestring), 'Desktop files can not store complex data' return json.dumps(value)[1:-1].replace('\\"', '"') # get rid of quotes
def serialize_zim_config(self): '''Serialize to string @returns: the list content as a json formatted string ''' data = [(path.name, path.cursor, path.scroll) for path in self] return json.dumps(data, separators=(',', ':'))
def serialize_zim_config(self): '''Serialize to string @returns: the list content as a json formatted string ''' data = [(path.name, path.cursor, path.scroll) for path in self] return json.dumps(data, separators=(',',':'))