changeset 83:b9179968a272

- fix set_params (strange) - allow overriding settings in another config file
author Matt Johnston <matt@ucc.asn.au>
date Wed, 11 Jul 2012 23:37:13 +0800
parents 0f7c005b3f87
children ccce79dcb316
files main.c web/config.py
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Wed Jul 11 22:50:23 2012 +0800
+++ b/main.c	Wed Jul 11 23:37:13 2012 +0800
@@ -486,10 +486,9 @@
     {
         cmd_get_params();
     }
-    else if (strncmp_P(readbuf, PSTR("set_params "), 
-                strlen("set_params ") == 0))
+    else if (strncmp_P(readbuf, PSTR("set_params "), 11) == 0)
     {
-        cmd_set_params(&readbuf[strlen("set_params ")]);
+        cmd_set_params(&readbuf[11]);
     }
     else if (strcmp_P(readbuf, PSTR("awake")) == 0)
     {
@@ -501,7 +500,7 @@
     }
     else
     {
-        printf_P(PSTR("Bad command\n"));
+        printf_P(PSTR("Bad command '%s'\n"), readbuf);
     }
 }
 
--- a/web/config.py	Wed Jul 11 22:50:23 2012 +0800
+++ b/web/config.py	Wed Jul 11 23:37:13 2012 +0800
@@ -5,7 +5,7 @@
 
 DATA_PATH = '/home/matt/templog/web/data'
 
-HMAC_KEY = 'a hmac key'
+HMAC_KEY = 'a hmac key' # override in local config file
 
 UPDATE_URL = 'https://evil.ucc.asn.au/~matt/templog/update'
 
@@ -33,3 +33,12 @@
 
 # determine by zooming in an image viewer
 GRAPH_LEFT_MARGIN = 63
+
+try:
+    import localconfig
+    g = globals()
+    for k in dir(other):
+        if k in g:
+            g[k] = other.__dict__[k]
+except ImportError:
+    pass