changeset 6573:fc6b1b0e1096

ini: set 'debug' only in one place In Pylons-based Kallithea, the 'debug' option was set first in [DEFAULTS] and then overridden with 'set debug = X' in [app:main]. Even when the value under [DEFAULTS] was commented out, the use of the 'set' keyword (providing override semantics) was required, because a default value for the global 'debug' was provided in the framework. The presence of these two debug assignments is confusing. Moreover, TurboGears2 makes the situation more easy and does not expect 'debug' to be in [DEFAULTS] nor does it provide a default at that level. As a result, we can simple use 'debug = X' under [app:main]. Additionally, clarify the Big Fat Warning: the wording 'the line below' is ambiguous and could be misunderstood in an ini file that had previously been changed.
author Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
date Fri, 27 Jan 2017 21:31:37 +0100
parents be56b2426b90
children e223c36e5b68
files development.ini kallithea/lib/paster_commands/template.ini.mako kallithea/tests/test.ini scripts/generate-ini.py
diffstat 4 files changed, 10 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/development.ini	Fri Jan 27 21:24:08 2017 +0100
+++ b/development.ini	Fri Jan 27 21:31:37 2017 +0100
@@ -4,7 +4,7 @@
 # listening on *:5000                                                          #
 # sqlite and kallithea.db                                                      #
 # initial_repo_scan = true                                                     #
-# set debug = true                                                             #
+# debug = true                                                                 #
 # verbose and colorful logging                                                 #
 #                                                                              #
 # The %(here)s variable will be replaced with the parent directory of this file#
@@ -12,7 +12,6 @@
 ################################################################################
 
 [DEFAULT]
-debug = true
 
 ################################################################################
 ## Email settings                                                             ##
@@ -466,12 +465,12 @@
 sentry.exclude_paths =
 
 ################################################################################
-## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*  ##
+## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT*              ##
 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to  ##
 ## execute malicious code after an exception is raised.                       ##
 ################################################################################
-#set debug = false
-set debug = true
+#debug = false
+debug = true
 
 ##################################
 ###       LOGVIEW CONFIG       ###
--- a/kallithea/lib/paster_commands/template.ini.mako	Fri Jan 27 21:24:08 2017 +0100
+++ b/kallithea/lib/paster_commands/template.ini.mako	Fri Jan 27 21:31:37 2017 +0100
@@ -6,7 +6,6 @@
 <%text>################################################################################</%text>
 
 [DEFAULT]
-debug = true
 
 <%text>################################################################################</%text>
 <%text>## Email settings                                                             ##</%text>
@@ -467,11 +466,11 @@
 
 %endif
 <%text>################################################################################</%text>
-<%text>## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*  ##</%text>
+<%text>## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT*              ##</%text>
 <%text>## Debug mode will enable the interactive debugging tool, allowing ANYONE to  ##</%text>
 <%text>## execute malicious code after an exception is raised.                       ##</%text>
 <%text>################################################################################</%text>
-set debug = false
+debug = false
 
 <%text>##################################</%text>
 <%text>###       LOGVIEW CONFIG       ###</%text>
--- a/kallithea/tests/test.ini	Fri Jan 27 21:24:08 2017 +0100
+++ b/kallithea/tests/test.ini	Fri Jan 27 21:31:37 2017 +0100
@@ -10,7 +10,6 @@
 ################################################################################
 
 [DEFAULT]
-debug = true
 
 ################################################################################
 ## Email settings                                                             ##
@@ -471,11 +470,11 @@
 sentry.exclude_paths =
 
 ################################################################################
-## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*  ##
+## WARNING: *DEBUG MODE MUST BE OFF IN A PRODUCTION ENVIRONMENT*              ##
 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to  ##
 ## execute malicious code after an exception is raised.                       ##
 ################################################################################
-set debug = false
+debug = false
 
 ##################################
 ###       LOGVIEW CONFIG       ###
--- a/scripts/generate-ini.py	Fri Jan 27 21:24:08 2017 +0100
+++ b/scripts/generate-ini.py	Fri Jan 27 21:31:37 2017 +0100
@@ -72,7 +72,7 @@
         listening on *:5000
         sqlite and kallithea.db
         initial_repo_scan = true
-        set debug = true
+        debug = true
         verbose and colorful logging
 
         The %(here)s variable will be replaced with the parent directory of this file
@@ -83,7 +83,7 @@
             },
             '[app:main]': {
                 'initial_repo_scan': 'true',
-                'set debug': 'true',
+                'debug': 'true',
                 'app_instance_uuid': 'development-not-secret',
                 'beaker.session.secret': 'development-not-secret',
             },