diff MoinMoin/app.py @ 83:8a5be4814a48

use console_script entry point - setup.py now installs a "moin" script for the platform loading the config file now works like this: - from given file (-c path/filename) - from env variable MOINCFG - from current directory: wikiconfig_local.py, wikiconfig.py (in that order)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 06 Mar 2011 22:47:02 +0100
parents 8102f92d21b8
children e4c332436733
line wrap: on
line diff
--- a/MoinMoin/app.py	Sun Mar 06 21:40:22 2011 +0100
+++ b/MoinMoin/app.py	Sun Mar 06 22:47:02 2011 +0100
@@ -66,7 +66,16 @@
     if flask_config_file:
         app.config.from_pyfile(flask_config_file)
     else:
-        app.config.from_envvar('MOINCFG', silent=True)
+        if not app.config.from_envvar('MOINCFG', silent=True):
+            # no MOINCFG env variable set, try stuff in cwd:
+            from os import path
+            flask_config_file = path.abspath('wikiconfig_local.py')
+            if not path.exists(flask_config_file):
+                flask_config_file = path.abspath('wikiconfig.py')
+                if not path.exists(flask_config_file):
+                    flask_config_file = None
+            if flask_config_file:
+                app.config.from_pyfile(flask_config_file)
     if flask_config_dict:
         app.config.update(flask_config_dict)
     Config = moin_config_class