mirror of
https://github.com/YunoHost/apps.git
synced 2024-09-03 20:06:07 +02:00
Format Python code with Black (#2325)
Co-authored-by: alexAubin <4533074+alexAubin@users.noreply.github.com>
This commit is contained in:
parent
320df5b086
commit
cb5c0de34f
1 changed files with 19 additions and 13 deletions
32
store/app.py
32
store/app.py
|
@ -502,27 +502,33 @@ def news_rss():
|
||||||
news_per_date = json.loads(open(".cache/news.json").read())
|
news_per_date = json.loads(open(".cache/news.json").read())
|
||||||
|
|
||||||
# Keepy only the last N entries
|
# Keepy only the last N entries
|
||||||
news_per_date = {d: infos for d, infos in reversed(list(news_per_date.items())[-2:])}
|
news_per_date = {
|
||||||
|
d: infos for d, infos in reversed(list(news_per_date.items())[-2:])
|
||||||
|
}
|
||||||
|
|
||||||
rss_xml = render_template('news_rss.xml', news_per_date=news_per_date, catalog=get_catalog())
|
rss_xml = render_template(
|
||||||
|
"news_rss.xml", news_per_date=news_per_date, catalog=get_catalog()
|
||||||
|
)
|
||||||
response = make_response(rss_xml)
|
response = make_response(rss_xml)
|
||||||
response.headers['Content-Type'] = 'application/rss+xml'
|
response.headers["Content-Type"] = "application/rss+xml"
|
||||||
response.headers['Content-Disposition'] = "inline; filename=news_rss.xml"
|
response.headers["Content-Disposition"] = "inline; filename=news_rss.xml"
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
# Badges
|
# Badges
|
||||||
@app.route('/integration/<app>')
|
@app.route("/integration/<app>")
|
||||||
@app.route('/integration/<app>.svg')
|
@app.route("/integration/<app>.svg")
|
||||||
@app.route('/badge/<type>/<app>')
|
@app.route("/badge/<type>/<app>")
|
||||||
@app.route('/badge/<type>/<app>.svg')
|
@app.route("/badge/<type>/<app>.svg")
|
||||||
def badge(app, type="integration"):
|
def badge(app, type="integration"):
|
||||||
|
|
||||||
data = get_dashboard_data()
|
data = get_dashboard_data()
|
||||||
catalog = get_catalog()["apps"]
|
catalog = get_catalog()["apps"]
|
||||||
|
|
||||||
catalog_level = catalog.get(app, {}).get("level")
|
catalog_level = catalog.get(app, {}).get("level")
|
||||||
main_ci_level = data.get(app, {}).get("ci_results", {}).get("main", {}).get("level", '?')
|
main_ci_level = (
|
||||||
|
data.get(app, {}).get("ci_results", {}).get("main", {}).get("level", "?")
|
||||||
|
)
|
||||||
|
|
||||||
if type == "integration":
|
if type == "integration":
|
||||||
if app in catalog and main_ci_level:
|
if app in catalog and main_ci_level:
|
||||||
|
@ -533,7 +539,7 @@ def badge(app, type="integration"):
|
||||||
if app not in catalog:
|
if app not in catalog:
|
||||||
badge = "state-unknown"
|
badge = "state-unknown"
|
||||||
else:
|
else:
|
||||||
if catalog_level in [None, '?']:
|
if catalog_level in [None, "?"]:
|
||||||
badge = "state-just-got-added-to-catalog"
|
badge = "state-just-got-added-to-catalog"
|
||||||
elif catalog_level in [0, -1]:
|
elif catalog_level in [0, -1]:
|
||||||
badge = "state-broken"
|
badge = "state-broken"
|
||||||
|
@ -549,9 +555,9 @@ def badge(app, type="integration"):
|
||||||
|
|
||||||
svg = open(f"assets/badges/{badge}.svg").read()
|
svg = open(f"assets/badges/{badge}.svg").read()
|
||||||
response = make_response(svg)
|
response = make_response(svg)
|
||||||
response.content_type = 'image/svg+xml'
|
response.content_type = "image/svg+xml"
|
||||||
response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
|
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
||||||
response.headers['Pragma'] = 'no-cache'
|
response.headers["Pragma"] = "no-cache"
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue