Fix updateinfo date format and enable short tags

This commit is contained in:
Mustafa Gezen 2023-02-04 08:59:44 +01:00
parent 6300c73b56
commit b758793987
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1

View File

@ -95,10 +95,10 @@ async def get_updateinfo(
# Add time # Add time
time_format = "%Y-%m-%d %H:%M:%S" time_format = "%Y-%m-%d %H:%M:%S"
ET.SubElement(update, "issued" issued = ET.SubElement(update, "issued")
).text = advisory.published_at.strftime(time_format) issued.set("date", advisory.published_at.strftime(time_format))
ET.SubElement(update, "updated" updated = ET.SubElement(update, "updated")
).text = advisory.updated_at.strftime(time_format) updated.set("date", advisory.updated_at.strftime(time_format))
# Add rights # Add rights
now = datetime.datetime.utcnow() now = datetime.datetime.utcnow()
@ -313,6 +313,11 @@ async def get_updateinfo(
tree.remove(update) tree.remove(update)
ET.indent(tree) ET.indent(tree)
xml_str = ET.tostring(tree, encoding="unicode", method="xml") xml_str = ET.tostring(
tree,
encoding="unicode",
method="xml",
short_empty_elements=True,
)
return Response(content=xml_str, media_type="application/xml") return Response(content=xml_str, media_type="application/xml")