housekeep: centralize datetime generation

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2022-01-18 05:59:52 -08:00
parent 7bcc8d7ce7
commit 7f6c23d4cb
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
41 changed files with 146 additions and 179 deletions

View file

@ -1,9 +1,8 @@
from datetime import datetime
from typing import Any, Dict
from fastapi import Request
from aurweb import cookies, db, models
from aurweb import cookies, db, models, time
from aurweb.models.ssh_pub_key import get_fingerprint
from aurweb.util import strtobool
@ -14,7 +13,7 @@ def simple(U: str = str(), E: str = str(), H: bool = False,
CN: bool = False, UN: bool = False, ON: bool = False,
S: bool = False, user: models.User = None,
**kwargs) -> None:
now = int(datetime.utcnow().timestamp())
now = time.utcnow()
with db.begin():
user.Username = U or user.Username
user.Email = E or user.Email