summary refs log tree commit diff
path: root/synapse/push/__init__.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-02-09 17:01:40 +0000
committerDavid Baker <dave@matrix.org>2015-02-09 17:01:40 +0000
commit8f616684a3a712ccf06349c67bb64779f06d8da1 (patch)
treefab1947f910f1fea6ac8b97a8dac3448081685ae /synapse/push/__init__.py
parentoops (diff)
downloadsynapse-8f616684a3a712ccf06349c67bb64779f06d8da1.tar.xz
Need to use re.search if looking for matches not at the start of the string. Also comparisons with None should be 'is'.
Diffstat (limited to 'synapse/push/__init__.py')
-rw-r--r--synapse/push/__init__.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py
index 58c8cf700b..6f143a5df9 100644
--- a/synapse/push/__init__.py
+++ b/synapse/push/__init__.py
@@ -154,7 +154,7 @@ class Pusher(object):
             val = _value_for_dotted_key(condition['key'], ev)
             if val is None:
                 return False
-            return re.match(r, val, flags=re.IGNORECASE) != None
+            return re.search(r, val, flags=re.IGNORECASE) is not None
 
         elif condition['kind'] == 'device':
             if 'profile_tag' not in condition:
@@ -170,8 +170,8 @@ class Pusher(object):
                 return False
             if not display_name:
                 return False
-            return re.match("\b%s\b" % re.escape(display_name),
-                            ev['content']['body'], flags=re.IGNORECASE) != None
+            return re.search("\b%s\b" % re.escape(display_name),
+                            ev['content']['body'], flags=re.IGNORECASE) is not None
 
         elif condition['kind'] == 'room_member_count':
             if 'is' not in condition: