[gimp-web/wip/Jehan/issue-236-new-sponsor-page: 12/21] plugins: testing a different rendering for the mirror sponsors.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-web/wip/Jehan/issue-236-new-sponsor-page: 12/21] plugins: testing a different rendering for the mirror sponsors.
- Date: Tue, 14 Sep 2021 20:49:12 +0000 (UTC)
commit 6d2ac0d505186608d920fd2c1acc7f6983537b9c
Author: Jehan <jehan girinstud io>
Date: Sat Aug 28 18:07:44 2021 +0200
plugins: testing a different rendering for the mirror sponsors.
Instead of per-country, just a single list (alphabetical order), with
the full location (not just country, but city or other info) between
parentheses.
plugins/gimp_mirrors/gimp_mirrors.py | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/plugins/gimp_mirrors/gimp_mirrors.py b/plugins/gimp_mirrors/gimp_mirrors.py
index fca92ad3..87d3bd21 100644
--- a/plugins/gimp_mirrors/gimp_mirrors.py
+++ b/plugins/gimp_mirrors/gimp_mirrors.py
@@ -35,18 +35,12 @@ class UnexpectedException(Exception): pass
def html_output(data):
html = u"<dl class='download-mirrors'>\n"
- for country, values in sorted(data.items()):
- html += u"<dt>{}</dt>".format(country)
-
- for name, url in sorted(values.items()):
- if isinstance(url, str):
- # In Python3 str are unicode strings.
- tmp = url
- else:
- tmp = url.decode('utf-8')
- html += u"<dd><a href='{}'>{}</a></dd>\n".format(tmp, name)
-
- html += u"</dl>"
+ html += u"<ul>"
+ for name, values in sorted(data.items()):
+ html += u"<li><a href='{}'>{}</a> (<em>{}</em>)</li>".format(values['url'],
+ name,
+ values['location'])
+ html += u"</ul>"
return html
@@ -88,10 +82,14 @@ def do_mirrors(path, context):
except:
print("WARNING: cannot resolve record for {}: {} ".format(record, domain))
- if country in mirrors:
- mirrors[country][record] = data[record]['about']
+ if 'location' in data[record]:
+ location = '{}, {}'.format(data[record]['location'], country)
else:
- mirrors[country] = { record: data[record]['about'] }
+ location = country
+ mirrors[record] = {
+ 'url': data[record]['about'],
+ 'location': location
+ }
try:
with open( path, 'rb') as f:
s = f.read()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]