def save(self): """Save the config to disk.""" # we don't want to pickle this class, but the dict itself raw_dict = self.copy() logger.debug("Saving: %s", self) with utils.SafeSaver(self._fname) as fh: pickle.dump(raw_dict, fh)
def save(self): """Save the config to disk.""" # we don't want to pickle this class, but the dict itself raw_dict = self.copy() if keyring is not None: for key in SECURITY_CONFIG: keyring.set_password('encuentro', key, raw_dict.pop(key)) logger.debug("Saving: %s", self.sanitized_config()) with utils.SafeSaver(self._fname) as fh: pickle.dump(raw_dict, fh)
def _d_callback(data, episode_id, file_fullname): """Cache the image and use the callback.""" content_type, img_data = data content, extension = content_type.split('/') if content != 'image': logger.debug("The Content-Type header is not 'image'") file_fullname = file_fullname + '.' + extension logger.debug( "Image downloaded for episode_id %s, " "saving to %r, Content-Type= %s", episode_id, file_fullname, content_type) with utils.SafeSaver(file_fullname) as fh: fh.write(img_data) self.callback(episode_id, file_fullname)
def save(self): """Save to disk.""" to_save = (self.last_programs_version, self.data) with utils.SafeSaver(self.filename) as fh: pickle.dump(to_save, fh)