From 561194c2c27d1391613cb0aefd5e5335e6355f43 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Sat, 21 Dec 2013 10:01:12 +1100 Subject: [PATCH] Profile: be sure to strip newline from 'who' in alert file. --- lib/profile.py | 4 ++-- utils/lock.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) 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) -- 2.39.5