[gimp-web/wip/Jehan/gimp-versions: 6/6] pelicanconf: process the new gimp_versions.json format.



commit f2eea7eb30b53438aa49ca1822e9350bc72f1c6f
Author: Jehan <jehan girinstud io>
Date:   Sat Jan 4 23:32:41 2020 +0100

    pelicanconf: process the new gimp_versions.json format.
    
    See previous commit and #168.

 pelicanconf.local.py                                | 21 +++++++++++----------
 pelicanconf.py                                      | 21 +++++++++++----------
 pelicanconf.testing.py                              | 21 +++++++++++----------
 themes/newgimp/templates/downloads-development.html |  3 ++-
 themes/newgimp/templates/downloads-oldstable.html   |  2 +-
 themes/newgimp/templates/downloads.html             |  2 +-
 6 files changed, 37 insertions(+), 33 deletions(-)
---
diff --git a/pelicanconf.local.py b/pelicanconf.local.py
index b5dddd8d..3712abbe 100644
--- a/pelicanconf.local.py
+++ b/pelicanconf.local.py
@@ -151,11 +151,11 @@ with open('content/gimp_versions.json') as data:
 if 'STABLE' in GIMP:
     # Set the current stable GIMP version from
     # the GIMP_VERSIONS json file.  The most
-    # current version _should_ be the first key
-    # hence, .keys()[0]
-    GIMP_VERSION = GIMP['STABLE'].keys()[0]
+    # current version _should_ be the first key.
+    GIMP_VERSION = GIMP['STABLE'][0]['version']
     GIMP_MAJOR_MINOR_VERSION = GIMP_VERSION[:GIMP_VERSION.index('.', GIMP_VERSION.index('.') + 1)]
-    for version, info in GIMP['STABLE'].iteritems() :
+    for info in GIMP['STABLE'] :
+        version = info['version']
         if 'date' in info:
             try:
                 RELEASE_DATE
@@ -200,11 +200,11 @@ else:
 if 'OLDSTABLE' in GIMP:
     # Set the current stable GIMP version from
     # the GIMP_VERSIONS json file.  The most
-    # current version _should_ be the first key
-    # hence, .keys()[0]
-    GIMP_VERSION_OLDSTABLE = GIMP['OLDSTABLE'].keys()[0]
+    # current version _should_ be the first key.
+    GIMP_VERSION_OLDSTABLE = GIMP['OLDSTABLE'][0]['version']
     GIMP_MAJOR_MINOR_VERSION_OLDSTABLE= GIMP_VERSION_OLDSTABLE[:GIMP_VERSION_OLDSTABLE.index('.', 
GIMP_VERSION_OLDSTABLE.index('.') + 1)]
-    for version, info in GIMP['OLDSTABLE'].iteritems() :
+    for info in GIMP['OLDSTABLE'] :
+        version = info['version']
         if 'date' in info:
             try:
                 RELEASE_DATE_OLDSTABLE
@@ -231,8 +231,9 @@ else:
 
 if 'DEVELOPMENT' in GIMP:
     # development version
-    GIMP_VERSION_DEVELOPMENT = GIMP['DEVELOPMENT'].keys()[0]
-    for version, info in GIMP['DEVELOPMENT'].iteritems() :
+    GIMP_VERSION_DEVELOPMENT = GIMP['DEVELOPMENT'][0]['version']
+    for info in GIMP['DEVELOPMENT'] :
+        version = info['version']
         if 'date' in info:
             try:
                 RELEASE_DATE_DEVELOPMENT
diff --git a/pelicanconf.py b/pelicanconf.py
index 1b21037c..ba785724 100644
--- a/pelicanconf.py
+++ b/pelicanconf.py
@@ -138,11 +138,11 @@ with open('content/gimp_versions.json') as data:
 if 'STABLE' in GIMP:
     # Set the current stable GIMP version from
     # the GIMP_VERSIONS json file.  The most
-    # current version _should_ be the first key
-    # hence, .keys()[0]
-    GIMP_VERSION = GIMP['STABLE'].keys()[0]
+    # current version _should_ be the first key.
+    GIMP_VERSION = GIMP['STABLE'][0]['version']
     GIMP_MAJOR_MINOR_VERSION = GIMP_VERSION[:GIMP_VERSION.index('.', GIMP_VERSION.index('.') + 1)]
-    for version, info in GIMP['STABLE'].iteritems() :
+    for info in GIMP['STABLE'] :
+        version = info['version']
         if 'date' in info:
             try:
                 RELEASE_DATE
@@ -186,11 +186,11 @@ else:
 if 'OLDSTABLE' in GIMP:
     # Set the current stable GIMP version from
     # the GIMP_VERSIONS json file.  The most
-    # current version _should_ be the first key
-    # hence, .keys()[0]
-    GIMP_VERSION_OLDSTABLE = GIMP['OLDSTABLE'].keys()[0]
+    # current version _should_ be the first key.
+    GIMP_VERSION_OLDSTABLE = GIMP['OLDSTABLE'][0]['version']
     GIMP_MAJOR_MINOR_VERSION_OLDSTABLE= GIMP_VERSION_OLDSTABLE[:GIMP_VERSION_OLDSTABLE.index('.', 
GIMP_VERSION_OLDSTABLE.index('.') + 1)]
-    for version, info in GIMP['OLDSTABLE'].iteritems() :
+    for info in GIMP['OLDSTABLE'] :
+        version = info['version']
         if 'date' in info:
             try:
                 RELEASE_DATE_OLDSTABLE
@@ -217,8 +217,9 @@ else:
 
 if 'DEVELOPMENT' in GIMP:
     # development version
-    GIMP_VERSION_DEVELOPMENT = GIMP['DEVELOPMENT'].keys()[0]
-    for version, info in GIMP['DEVELOPMENT'].iteritems() :
+    GIMP_VERSION_DEVELOPMENT = GIMP['DEVELOPMENT'][0]['version']
+    for info in GIMP['DEVELOPMENT'] :
+        version = info['version']
         if 'date' in info:
             try:
                 RELEASE_DATE_DEVELOPMENT
diff --git a/pelicanconf.testing.py b/pelicanconf.testing.py
index b9ded5e0..4e7cb716 100644
--- a/pelicanconf.testing.py
+++ b/pelicanconf.testing.py
@@ -138,11 +138,11 @@ with open('content/gimp_versions.json') as data:
 if 'STABLE' in GIMP:
     # Set the current stable GIMP version from
     # the GIMP_VERSIONS json file.  The most
-    # current version _should_ be the first key
-    # hence, .keys()[0]
-    GIMP_VERSION = GIMP['STABLE'].keys()[0]
+    # current version _should_ be the first key.
+    GIMP_VERSION = GIMP['STABLE'][0]['version']
     GIMP_MAJOR_MINOR_VERSION = GIMP_VERSION[:GIMP_VERSION.index('.', GIMP_VERSION.index('.') + 1)]
-    for version, info in GIMP['STABLE'].iteritems() :
+    for info in GIMP['STABLE'] :
+        version = info['version']
         if 'date' in info:
             try:
                 RELEASE_DATE
@@ -186,11 +186,11 @@ else:
 if 'OLDSTABLE' in GIMP:
     # Set the current stable GIMP version from
     # the GIMP_VERSIONS json file.  The most
-    # current version _should_ be the first key
-    # hence, .keys()[0]
-    GIMP_VERSION_OLDSTABLE = GIMP['OLDSTABLE'].keys()[0]
+    # current version _should_ be the first key.
+    GIMP_VERSION_OLDSTABLE = GIMP['OLDSTABLE'][0]['version']
     GIMP_MAJOR_MINOR_VERSION_OLDSTABLE= GIMP_VERSION_OLDSTABLE[:GIMP_VERSION_OLDSTABLE.index('.', 
GIMP_VERSION_OLDSTABLE.index('.') + 1)]
-    for version, info in GIMP['OLDSTABLE'].iteritems() :
+    for info in GIMP['OLDSTABLE'] :
+        version = info['version']
         if 'date' in info:
             try:
                 RELEASE_DATE_OLDSTABLE
@@ -217,8 +217,9 @@ else:
 
 if 'DEVELOPMENT' in GIMP:
     # development version
-    GIMP_VERSION_DEVELOPMENT = GIMP['DEVELOPMENT'].keys()[0]
-    for version, info in GIMP['DEVELOPMENT'].iteritems() :
+    GIMP_VERSION_DEVELOPMENT = GIMP['DEVELOPMENT'][0]['version']
+    for info in GIMP['DEVELOPMENT'] :
+        version = info['version']
         if 'date' in info:
             try:
                 RELEASE_DATE_DEVELOPMENT
diff --git a/themes/newgimp/templates/downloads-development.html 
b/themes/newgimp/templates/downloads-development.html
index 7293c794..5ab13cf3 100644
--- a/themes/newgimp/templates/downloads-development.html
+++ b/themes/newgimp/templates/downloads-development.html
@@ -254,7 +254,8 @@
     <p>To allow you to check the integrity of the tarballs, here are the MD5 sums of the latest releases:</p>
 
     {% if GIMP.DEVELOPMENT %}
-        {% for version, values in GIMP.DEVELOPMENT.iteritems() %}
+        {% for values in GIMP.DEVELOPMENT %}
+            {% set version = values['version'] %}
             {% set ver = version.split('.') %}
             {% if 'source' in values %}
             <p>
diff --git a/themes/newgimp/templates/downloads-oldstable.html 
b/themes/newgimp/templates/downloads-oldstable.html
index 64bbe288..2bcd82d9 100644
--- a/themes/newgimp/templates/downloads-oldstable.html
+++ b/themes/newgimp/templates/downloads-oldstable.html
@@ -290,7 +290,7 @@
     <p>To allow you to check the integrity of the tarballs, here are the MD5 sums of the latest releases:</p>
 
     {% if GIMP.OLDSTABLE %}
-        {% for version, values in GIMP.OLDSTABLE.iteritems() %}
+        {% for values in GIMP.OLDSTABLE %}
             {% if 'source' in values %}
             <p>
                 <strong>{{ values['source'].keys()[0] }}</strong><br>
diff --git a/themes/newgimp/templates/downloads.html b/themes/newgimp/templates/downloads.html
index 52dbe0ab..f2dbb0c7 100644
--- a/themes/newgimp/templates/downloads.html
+++ b/themes/newgimp/templates/downloads.html
@@ -387,7 +387,7 @@
 
     {% if GIMP.STABLE %}
         <dl>
-        {% for version, values in GIMP.STABLE.iteritems() %}
+        {% for values in GIMP.STABLE %}
             {% if 'source' in values %}
               <dt><strong>{{ values['source'].keys()[0] }}</strong>
               {% if 'sha256' in values['source'].values()[0] %}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]