Changeset View
Changeset View
Standalone View
Standalone View
swh/vault/backend.py
Show First 20 Lines • Show All 445 Lines • ▼ Show 20 Lines | ) -> None: | ||||
# TODO: instead of hardcoding this, we should probably: | # TODO: instead of hardcoding this, we should probably: | ||||
# * add a "fetch_url" field in the vault_notif_email table | # * add a "fetch_url" field in the vault_notif_email table | ||||
# * generate the url with flask.url_for() on the web-ui side | # * generate the url with flask.url_for() on the web-ui side | ||||
# * send this url as part of the cook request and store it in | # * send this url as part of the cook request and store it in | ||||
# the table | # the table | ||||
# * use this url for the notification e-mail | # * use this url for the notification e-mail | ||||
url = "https://archive.softwareheritage.org/api/1/vault/{}/{}/" "raw".format( | url = "https://archive.softwareheritage.org/api/1/vault/{}/{}/" "raw".format( | ||||
bundle_type, swhid | bundle_type.replace("_", "-"), swhid | ||||
vlorentz: seems hacky. Shouldn't swh-web adapt its URL to the vault instead? | |||||
Done Inline ActionsI do not think so, we choose to use - to separate words in all API URLs so better sticking to it. anlambert: I do not think so, we choose to use `-` to separate words in all API URLs so better sticking to… | |||||
) | ) | ||||
if status == "done": | if status == "done": | ||||
text = NOTIF_EMAIL_BODY_SUCCESS.strip() | text = NOTIF_EMAIL_BODY_SUCCESS.strip() | ||||
text = text.format(bundle_type=bundle_type, swhid=swhid, url=url) | text = text.format(bundle_type=bundle_type, swhid=swhid, url=url) | ||||
msg = MIMEText(text) | msg = MIMEText(text) | ||||
msg["Subject"] = NOTIF_EMAIL_SUBJECT_SUCCESS.format( | msg["Subject"] = NOTIF_EMAIL_SUBJECT_SUCCESS.format( | ||||
bundle_type=bundle_type, short_id=short_id | bundle_type=bundle_type, short_id=short_id | ||||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |
seems hacky. Shouldn't swh-web adapt its URL to the vault instead?