Skip to content
Snippets Groups Projects
Commit c3fd0f94 authored by Martin van Es's avatar Martin van Es
Browse files

Some minor code formatting cleanup

parent 0dd922b6
No related branches found
No related tags found
No related merge requests found
......@@ -46,10 +46,12 @@ def serve_all(realm):
request = requests.get(f"{config[realm]['signer']}/{realm}"
f"/entities")
data = request.text
last_modified = request.headers.get('Last-Modified',
formatdate(timeval=None,
localtime=False,
usegmt=True))
last_modified = request.headers.get(
'Last-Modified',
formatdate(timeval=None,
localtime=False,
usegmt=True)
)
try:
root = ET.fromstring(data)
......
......@@ -30,8 +30,10 @@ def serve_all(realm):
datetime.now(tz.tzutc())).total_seconds())
response.headers['Cache-Control'] = f"max-age={max_age}"
response.headers['Last-Modified'] = formatdate(timeval=mktime(data.last_modified.timetuple()),
localtime=False, usegmt=True)
response.headers['Last-Modified'] = formatdate(
timeval=mktime(data.last_modified.timetuple()),
localtime=False,
usegmt=True)
return response
......@@ -57,8 +59,10 @@ def serve_one(realm, entity_id):
last_modified = datetime.now(tz.tzutc())
response.headers['Cache-Control'] = f"max-age={max_age}"
response.headers['Last-Modified'] = formatdate(timeval=mktime(last_modified.timetuple()),
localtime=False, usegmt=True)
response.headers['Last-Modified'] = formatdate(
timeval=mktime(last_modified.timetuple()),
localtime=False,
usegmt=True)
return response
......
......@@ -192,10 +192,10 @@ class Realm:
data = Entity()
ns = NSMAP
root = ET.Element(f"{{{MD_NAMESPACE}}}EntitiesDescriptor",
nsmap=ns)
nsmap=ns)
# We are going to minimize expires, so set to some inf value
valid_until = (datetime.now(tz.tzutc()) +
timedelta(days=365))
timedelta(days=365))
cache_duration = parse_duration("P1D")
for sha1, entity in self.idps.items():
valid_until = min(valid_until, entity.valid_until)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment