tzcache.py 文件源码

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

项目:railgun 作者: xin-xinhanggao 项目源码 文件源码
def make_cache(self):
        self.logger.info('start building tzcache ...')

        # Cache common timezone list
        dpath = os.path.join(
            config.RAILGUN_ROOT,
            'railgun/website/static/tz'
        )
        if not os.path.isdir(dpath):
            os.makedirs(dpath, 0755)
        tzlist = list(common_timezones)

        # Make each files
        for l in list_locales():
            tz = self.mktz(tzlist, l)
            tzfile = os.path.join(
                config.RAILGUN_ROOT,
                'railgun/website/static/tz/%s.json' % str(l)
            )
            with open(tzfile, 'wb') as f:
                f.write(json.dumps(tz))
            self.logger.info('tzcache "%s": ok.' % tzfile)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号