<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Okay, I have looked through the code and need some clarifications.<div><br></div><div>1. Are you proposing to ditch the “old_config” instance in the App which holds the lnt.server.config.Config? Then centralize all LNT config stuff in the App.Config? Or just make old_config a second instance of flask.Config, or perhaps have it wrap a flask.Config?</div><div><br></div><div>After reading, flask.Config is nothing magic, just a dict which has some good import methods.</div><div><br><div><div>On Jan 21, 2014, at 3:08 PM, Daniel Dunbar <<a href="mailto:daniel@zuster.org">daniel@zuster.org</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">If we are going to go this route, I think I would rather we just move to using Flask's app.config.from_pyfile() and ditch our custom config wrapper. We could start by using app.config.from_pyfile() on the lnt.cfg file, and then eventually ditch our wrapper once it isn't used, which would probably be a simple start to get the equivalent of this patch.<div>
<div><div><br></div><div> - Daniel</div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jan 21, 2014 at 10:20 AM, Chris Matthews <span dir="ltr"><<a href="mailto:chris.matthews@apple.com" target="_blank">chris.matthews@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I’d like to propose LNT collect all configuration directives out of the lnt.cfg configuration file. My motivation for this is that I have been developing experimental LNT functionality by building flask extensions out of tree, where they don’t break things. Currently the LNT Config class looks for explicit keys in the config file, and adds those to the flask app config. To allow out of tree modules to add configuration directives, I have patched config so that all directives in the file are added to the config object, making sure not to overwrite any that are there already.</div>
<div><br></div><div><div><font face="Menlo">diff --git a/lnt/server/config.py b/lnt/server/config.py</font></div><div><font face="Menlo">index 2e146b9fece5adb75cecbea65aa1899261940cb2..6bc5c4d5232332bc4be4e627e365ad2afacebb14 100644</font></div>
<div><font face="Menlo">--- a/lnt/server/config.py</font></div><div><font face="Menlo">+++ b/lnt/server/config.py</font></div><div><font face="Menlo">@@ -97,13 +97,20 @@ class Config:</font></div><div><font face="Menlo"> </font></div>
<div><font face="Menlo"> secretKey = data.get('secret_key', None)</font></div><div><font face="Menlo"> </font></div><div><font face="Menlo">- return Config(data.get('name', 'LNT'), data['zorgURL'],</font></div>
<div><font face="Menlo">+ cfg = Config(data.get('name', 'LNT'), data['zorgURL'],</font></div><div><font face="Menlo"> dbDir, os.path.join(baseDir, tempDir), secretKey,</font></div>
<div><font face="Menlo"> dict([(k,DBInfo.fromData(dbDirPath, v,</font></div><div><font face="Menlo"> default_email_config))</font></div><div><font face="Menlo"> for k,v in data['databases'].items()]),</font></div>
<div><font face="Menlo"> data.get('baselineRevision', '144168'))</font></div><div><font face="Menlo">- </font></div><div><font face="Menlo">+</font></div><div><font face="Menlo">+ # Add any remaining keys to the config object.</font></div>
<div><font face="Menlo">+ for key, val in data.items():</font></div><div><font face="Menlo">+ if not hasattr(cfg, key):</font></div><div><font face="Menlo">+ setattr(cfg, key, val)</font></div>
<div><font face="Menlo">+ return cfg</font></div><div><font face="Menlo">+</font></div><div><font face="Menlo">+</font></div><div><font face="Menlo"> @staticmethod</font></div><div><font face="Menlo"> def dummyInstance():</font></div>
<div><font face="Menlo"> baseDir = tempfile.mkdtemp() </font></div></div><div><br></div><div><br></div><div></div></div><br><div style="word-wrap:break-word"><div></div></div>
<br></blockquote></div><br></div>
</blockquote></div><br></div></body></html>