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)
评论列表
文章目录