mark_online. Route handler or application helper. This docstring was expanded to make future maintenance easier. Args: username: Parameter. scope: Parameter. Returns: Varies.
(username: str, scope: str)
| 1187 | ak = (row["accent_key"] or "").strip() |
| 1188 | fk = (row["font_key"] or "").strip() |
| 1189 | tk = (row["ui_theme_key"] or "").strip() if "ui_theme_key" in row.keys() else "" |
| 1190 | if ak in ACCENT_PRESETS: |
| 1191 | prefs["accent_key"] = ak |
| 1192 | if fk in FONT_PRESETS: |
| 1193 | prefs["font_key"] = fk |
| 1194 | if tk in UI_THEME_PRESETS: |
| 1195 | prefs["ui_theme_key"] = tk |
| 1196 | except Exception: |
| 1197 | pass |
| 1198 | return prefs |
| 1199 | |
| 1200 | |
| 1201 | def set_user_prefs(username: str, accent_key: str, font_key: str, ui_theme_key: Optional[str]=None) -> None: |
| 1202 | """Persist UI preferences for a user.""" |
| 1203 | if not username: |
| 1204 | return |
| 1205 | ak = accent_key if accent_key in ACCENT_PRESETS else DEFAULT_PREFS["accent_key"] |
| 1206 | fk = font_key if font_key in FONT_PRESETS else DEFAULT_PREFS["font_key"] |
| 1207 | tk = ui_theme_key if ui_theme_key in UI_THEME_PRESETS else DEFAULT_PREFS["ui_theme_key"] |
| 1208 | try: |
| 1209 | conn = db_connect() |
no outgoing calls
no test coverage detected