NNTPSettings.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:newsreap 作者: caronc 项目源码 文件源码
def save(self, cfg_file=None):
        """
        Save's configuration back to disk.

        """
        if cfg_file is None:
            cfg_file = self.cfg_file

        else:
            # acquire new configuration path
            cfg_file = abspath(expanduser(cfg_file))

        try:
            with open(cfg_file, 'w') as fp:
                yaml.dump(self.cfg_data, fp, default_flow_style=False)

        except IOError, e:
            logger.debug('%s' % (str(e)))
            logger.error('Failed to write configuration file %s' % (
                cfg_file,
            ))
            return False

        # Update central configuration
        self.cfg_file = cfg_file

        if hasattr(self, '__mask_re'):
            # Presumably something has changed if the user called save so we
            # destroy our cached mask to be safe
            del self.__mask_re

        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号