diff py/params.py @ 465:a40f30fad8f6

Merge
author Matt Johnston <matt@ucc.asn.au>
date Mon, 21 Jan 2013 07:25:52 +0800
parents 1eb68df9f8ab
children 5d5424acfed0
line wrap: on
line diff
--- a/py/params.py	Mon Jan 21 07:25:29 2013 +0800
+++ b/py/params.py	Mon Jan 21 07:25:52 2013 +0800
@@ -2,6 +2,7 @@
 import collections
 import json
 import signal
+import StringIO
 
 import gevent
 
@@ -13,6 +14,7 @@
     'fridge_difference': 0.2,
     'overshoot_delay': 720, # 12 minutes
     'overshoot_factor': 1, # ÂșC
+    'disabled': False,
     }
 
 class Params(dict):
@@ -48,6 +50,10 @@
                 raise self.Error("Unknown parameter %s=%s in file '%s'" % (str(k), str(u[k]), getattr(f, 'name', '???')))
         self.update(u)
 
+        L("Loaded parameters")
+        L(self.save_string())
+
+
     def save(self, f = None):
         if not f:
             f = file(config.PARAMS_FILE, 'w')
@@ -55,9 +61,14 @@
         f.write('\n')
         f.flush()
 
+    def save_string(self):
+        s = StringIO.StringIO()
+        self.save(s)
+        return s.getvalue()
+
     def reload_signal(self):
         try:
             self.load()
-            L("Reloaded params")
+            L("Reloaded.")
         except self.Error, e:
             W("Problem reloading: %s" % str(e))