fix: typing fixes since moving to Mapped types in models
This commit is contained in:
parent
d08388c339
commit
4693e994ba
5 changed files with 71 additions and 44 deletions
|
@ -1,4 +1,5 @@
|
|||
import json
|
||||
import logging
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from typing import Optional
|
||||
|
||||
|
@ -52,6 +53,9 @@ portal.register_blueprint(webhook, url_prefix="/webhook")
|
|||
|
||||
@portal.app_template_filter("bridge_expiry")
|
||||
def calculate_bridge_expiry(b: Bridge) -> str:
|
||||
if b.deprecated is None:
|
||||
logging.warning("Bridge expiry requested by template for a bridge %s that was not expiring.", b.id)
|
||||
return "Not expiring"
|
||||
expiry = b.deprecated + timedelta(hours=b.conf.expiry_hours)
|
||||
countdown = expiry - datetime.utcnow()
|
||||
if countdown.days == 0:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue