linuxrouter/docker/routlin-dash/app/pages/preferences/view.py

14 lines
483 B
Python
Raw Normal View History

2026-06-02 00:47:03 -04:00
import json
from flask import session
import sanitize
2026-06-02 12:49:39 -04:00
from config_utils import collect_layout_tokens
2026-06-02 00:47:03 -04:00
def collect_tokens(cfg):
2026-06-02 12:49:39 -04:00
tokens = collect_layout_tokens(cfg)
2026-06-02 00:47:03 -04:00
blank = [{'value': '', 'label': '-- Select timezone --'}]
2026-06-02 12:49:39 -04:00
tokens['PREF_EMAIL'] = session.get('email_address', '')
tokens['PREF_TIMEZONE'] = session.get('timezone', '')
tokens['TIMEZONE_OPTIONS'] = json.dumps(blank + [{'value': tz, 'label': tz} for tz in sanitize.VALID_TIMEZONES])
return tokens