From: NeilBrown Date: Fri, 20 Dec 2013 23:01:12 +0000 (+1100) Subject: Profile: be sure to strip newline from 'who' in alert file. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=561194c2c27d1391613cb0aefd5e5335e6355f43;p=plato.git Profile: be sure to strip newline from 'who' in alert file. --- diff --git a/lib/profile.py b/lib/profile.py index 3f77bb9..162e208 100644 --- a/lib/profile.py +++ b/lib/profile.py @@ -75,7 +75,7 @@ def rule_matches(rule, event, who, when): - day-of-week: mo,we,fr-su - time-of-day: 10.00-11.30,23.30-01.30 """ - for r in rule.split(' '): + for r in rule.split(): if r == '': continue if r == event: @@ -86,7 +86,7 @@ def rule_matches(rule, event, who, when): return False c = False - for w in who.split(' '): + for w in who.split(): if w[-8:] == r[-8:]: c = True if c: diff --git a/utils/lock.py b/utils/lock.py index d7e0253..dcf9690 100755 --- a/utils/lock.py +++ b/utils/lock.py @@ -201,6 +201,7 @@ class SetAlerts: f = open(os.path.join(self.alertdir, name)) l = f.readline() f.close() + l = l.strip() except IOError: l = "new" n = do_alert(name, l)