def inject_globals():
import datetime
import dateutil.tz
import pytz
utc = datetime.datetime.now(tz=pytz.utc)
sa_tz = pytz.timezone('Africa/Johannesburg')
sa = utc.astimezone(sa_tz)
local_tz = dateutil.tz.tzlocal()
local = utc.astimezone(local_tz)
cti = utc.strftime('%Y-%m-%d %H:%M') + ' (UTC) • ' + sa.strftime('%H:%M (%Z)')
if local.tzname() not in ('UTC', sa.tzname()):
cti += ' • ' + local.strftime('%H:%M (%Z)')
vi = 'Librarian %s (%s)' % (app.config['_version_string'], app.config['_git_hash'])
lds_info = app.config.get('local_disk_staging')
if lds_info is not None:
staging_available = True
staging_dest_displayed = lds_info['displayed_dest']
staging_dest_path = lds_info['dest_prefix']
staging_username_placeholder = lds_info['username_placeholder']
else:
staging_available = False
staging_dest_displayed = None
staging_dest_path = None
staging_username_placeholder = None
return {
'current_time_info': cti,
'version_info': vi,
'staging_available': staging_available,
'staging_dest_displayed': staging_dest_displayed,
'staging_dest_path': staging_dest_path,
'staging_username_placeholder': staging_username_placeholder,
}
# JSON API
评论列表
文章目录