comparison py/params.py @ 219:16a83e2c97a0

sleep on a semaphore so it can start/stop immediately when there's a SIGHUP from the web UI. makes it seem more magical.
author Matt Johnston <matt@ucc.asn.au>
date Fri, 19 Dec 2014 21:52:50 +0800
parents 78255c49bf9a
children d9e81a563923
comparison
equal deleted inserted replaced
218:11631a7f4cf2 219:16a83e2c97a0
24 class Error(Exception): 24 class Error(Exception):
25 pass 25 pass
26 26
27 def __init__(self): 27 def __init__(self):
28 self.update(_FIELD_DEFAULTS) 28 self.update(_FIELD_DEFAULTS)
29 gevent.signal(signal.SIGHUP, self.reload_signal)
30 29
31 def __getattr__(self, k): 30 def __getattr__(self, k):
32 return self[k] 31 return self[k]
33 32
34 def __setattr__(self, k, v): 33 def __setattr__(self, k, v):
68 67
69 def save_string(self): 68 def save_string(self):
70 s = StringIO.StringIO() 69 s = StringIO.StringIO()
71 self.save(s) 70 self.save(s)
72 return s.getvalue() 71 return s.getvalue()
73
74 def reload_signal(self):
75 try:
76 self.load()
77 L("Reloaded.")
78 except self.Error, e:
79 W("Problem reloading: %s" % str(e))