Development
This commit is contained in:
parent
025adb9f15
commit
5b1f905ed0
7 changed files with 38 additions and 47 deletions
|
|
@ -10,16 +10,6 @@ _PAGE = Path(__file__).parent.name
|
|||
bp = Blueprint(_PAGE, __name__)
|
||||
|
||||
|
||||
def _tz_to_offset_seconds(tz_str):
|
||||
try:
|
||||
from zoneinfo import ZoneInfo
|
||||
from datetime import datetime
|
||||
return int(datetime.now(ZoneInfo(tz_str)).utcoffset().total_seconds())
|
||||
except Exception:
|
||||
import settings as _s
|
||||
return _s.get_host_utc_offset()
|
||||
|
||||
|
||||
@bp.route('/action/preferences/accountdetails_save', methods=['POST'])
|
||||
@auth.require_level('viewer')
|
||||
def accountdetails_save():
|
||||
|
|
@ -29,9 +19,7 @@ def accountdetails_save():
|
|||
flash('Timezone is required.', 'error')
|
||||
return redirect(f'/{_PAGE}')
|
||||
|
||||
tz_offset = _tz_to_offset_seconds(tz)
|
||||
session['timezone'] = tz
|
||||
session['tz_offset_seconds'] = tz_offset
|
||||
|
||||
flash('Preferences saved.', 'success')
|
||||
return redirect(f'/{_PAGE}')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue