[gimp-web/wip/Jehan/issue-236-new-sponsor-page: 11/15] 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: 11/15] plugins: testing a different rendering for the mirror sponsors.
- Date: Tue, 31 Aug 2021 13:49:06 +0000 (UTC)
commit 88dd5781b6fed0b0ad2c5e9c71b978a71487f3e6
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]