[gimp-web/testing] Move pelicanconf* specifics to each file



commit 7fd9ca91f66da6fdfc833560bd311eff7f041c25
Author: Pat David <patdavid gmail com>
Date:   Mon Feb 17 21:12:00 2020 -0600

    Move pelicanconf* specifics to each file
    
    Jehan cleaned up common stuff between all the config files, but there
    were some issues getting the vars working properly (eg: SITEURL).
    
    I've moved the config specifics to each of the relevant files from
    the customize_environment function.  This should address the build
    issues we were having with getting drafts built.

 pelicanconf.local.py   | 10 ++++++-
 pelicanconf.py         | 12 +++++++-
 pelicanconf.testing.py |  9 +++++-
 pelicanconf_common.py  | 74 +++++++++++++++++++++++++-------------------------
 4 files changed, 65 insertions(+), 40 deletions(-)
---
diff --git a/pelicanconf.local.py b/pelicanconf.local.py
index 127f2287..490b9b57 100644
--- a/pelicanconf.local.py
+++ b/pelicanconf.local.py
@@ -6,4 +6,12 @@ sys.path.append('.')
 
 # Import everything to the global scope.
 from pelicanconf_common import *
-customize_environment('local')
+#customize_environment('local')
+
+SITEURL = 'https://www.gimp.org'
+SITEMAP_SITEURL = 'https://www.gimp.org'
+
+LOAD_CONTENT_CACHE = True
+CHECK_MODIFIED_METHOD = 'mtime'
+CACHE_CONTENT = True
+RELATIVE_URLS = True
diff --git a/pelicanconf.py b/pelicanconf.py
index 8eb62a58..721dcf01 100644
--- a/pelicanconf.py
+++ b/pelicanconf.py
@@ -6,4 +6,14 @@ sys.path.append('.')
 
 # Import everything to the global scope.
 from pelicanconf_common import *
-customize_environment('production')
+#customize_environment('production')
+
+SITEURL = 'https://www.gimp.org'
+SITEMAP_SITEURL = 'https://www.gimp.org'
+
+FEED_DOMAIN = SITEURL
+FEED_ATOM = 'feeds/atom.xml'
+FEED_RSS = 'feeds/rss.xml'
+
+DELETE_OUTPUT_DIRECTORY = True
+RELATIVE_URLS = False
diff --git a/pelicanconf.testing.py b/pelicanconf.testing.py
index a8aedd73..d84871df 100644
--- a/pelicanconf.testing.py
+++ b/pelicanconf.testing.py
@@ -6,4 +6,11 @@ sys.path.append('.')
 
 # Import everything to the global scope.
 from pelicanconf_common import *
-customize_environment('testing')
+#customize_environment('testing')
+
+SITEURL = 'https://testing.gimp.org'
+SITEMAP_SITEURL = 'https://testing.gimp.org'
+
+FEED_DOMAIN = SITEURL
+FEED_ATOM = 'feeds/atom.xml'
+FEED_RSS = 'feeds/rss.xml'
diff --git a/pelicanconf_common.py b/pelicanconf_common.py
index b7b4fd71..1e5af1d3 100644
--- a/pelicanconf_common.py
+++ b/pelicanconf_common.py
@@ -24,43 +24,43 @@ AUTHOR_FEED_RSS = None
 DELETE_OUTPUT_DIRECTORY = False
 RELATIVE_URLS = False
 
-def customize_environment(environment):
-    global SITEURL, SITEMAP_SITEURL
-    global LOAD_CONTENT_CACHE, CHECK_MODIFIED_METHOD, CACHE_CONTENT
-    global FEED_DOMAIN, FEED_ATOM, FEED_RSS
-    global DELETE_OUTPUT_DIRECTORY
-    global RELATIVE_URLS
-
-    valid_environments = [ 'local', 'testing', 'production' ]
-    if environment not in valid_environments:
-        print("customize_environment() must be called with one of: {}".format(', '.join(valid_environments)))
-        exit(1)
-
-    if environment == 'testing':
-        SITEURL = 'https://testing.gimp.org'
-        SITEMAP_SITEURL = 'https://testing.gimp.org'
-    else:
-        SITEURL = 'https://www.gimp.org'
-        SITEMAP_SITEURL = 'https://www.gimp.org'
-
-    if environment == 'local':
-        #
-        # Caching build for faster regeneration
-        #
-        LOAD_CONTENT_CACHE = True
-        CHECK_MODIFIED_METHOD = 'mtime'
-        CACHE_CONTENT = True
-    else:
-        # Feed generation is usually not desired when developing
-        FEED_DOMAIN = SITEURL
-        FEED_ATOM = 'feeds/atom.xml'
-        FEED_RSS = 'feeds/rss.xml'
-
-        DELETE_OUTPUT_DIRECTORY = True
-
-    # When developing, you probably want document relative URLs - so set this to True
-    # When publishing, set to False
-    RELATIVE_URLS = True if environment == 'local' else False
+#def customize_environment(environment):
+#    global SITEURL, SITEMAP_SITEURL
+#    global LOAD_CONTENT_CACHE, CHECK_MODIFIED_METHOD, CACHE_CONTENT
+#    global FEED_DOMAIN, FEED_ATOM, FEED_RSS
+#    global DELETE_OUTPUT_DIRECTORY
+#    global RELATIVE_URLS
+#
+#    valid_environments = [ 'local', 'testing', 'production' ]
+#    if environment not in valid_environments:
+#        print("customize_environment() must be called with one of: {}".format(', 
'.join(valid_environments)))
+#        exit(1)
+#
+#    if environment == 'testing':
+#        SITEURL = 'https://testing.gimp.org'
+#        SITEMAP_SITEURL = 'https://testing.gimp.org'
+#    else:
+#        SITEURL = 'https://www.gimp.org'
+#        SITEMAP_SITEURL = 'https://www.gimp.org'
+#
+#    if environment == 'local':
+#        #
+#        # Caching build for faster regeneration
+#        #
+#        LOAD_CONTENT_CACHE = True
+#        CHECK_MODIFIED_METHOD = 'mtime'
+#        CACHE_CONTENT = True
+#    else:
+#        # Feed generation is usually not desired when developing
+#        FEED_DOMAIN = SITEURL
+#        FEED_ATOM = 'feeds/atom.xml'
+#        FEED_RSS = 'feeds/rss.xml'
+#
+#        DELETE_OUTPUT_DIRECTORY = True
+#
+#    # When developing, you probably want document relative URLs - so set this to True
+#    # When publishing, set to False
+#    RELATIVE_URLS = True if environment == 'local' else False
 
 #######################################
 ## Values common to all environments ##


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