Provide link back to source in fetch result
This commit is contained in:
parent
5cf7e8ef48
commit
256a52e902
|
@ -16,7 +16,6 @@ from flask import (
|
||||||
redirect,
|
redirect,
|
||||||
url_for,
|
url_for,
|
||||||
current_app,
|
current_app,
|
||||||
make_response,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from intake.core import intake_data_dir
|
from intake.core import intake_data_dir
|
||||||
|
@ -397,11 +396,10 @@ def fetch(source_name: str):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
items = fetch_items(source)
|
items = fetch_items(source)
|
||||||
titles = "\n".join(item.display_title for item in items)
|
|
||||||
update_items(source, items)
|
update_items(source, items)
|
||||||
response = make_response(f"Update returned {len(items)} items:\n{titles}", 200)
|
titles = "\n".join(f"<li>{item.display_title}</li>" for item in items)
|
||||||
response.mimetype = "text/plain"
|
source_url = url_for("source_feed", name=source_name)
|
||||||
return response
|
return f"Update returned {len(items)} items:<ul>{titles}</ul><p><a href=\"{source_url}\">{source_name}</a></p>"
|
||||||
except InvalidConfigException as ex:
|
except InvalidConfigException as ex:
|
||||||
abort(500, f"Could not fetch {source_name}:\n{ex}")
|
abort(500, f"Could not fetch {source_name}:\n{ex}")
|
||||||
except SourceUpdateException as ex:
|
except SourceUpdateException as ex:
|
||||||
|
|
Loading…
Reference in New Issue