mirror of
https://github.com/resf/distro-tools.git
synced 2024-11-21 20:51:27 +00:00
Fix updateinfo date format and enable short tags
This commit is contained in:
parent
6300c73b56
commit
b758793987
@ -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")
|
||||||
|
Loading…
Reference in New Issue
Block a user