Remove __getitem__ and __contains__ from EventBase

This commit is contained in:
Erik Johnston 2018-02-26 16:00:36 +00:00
parent 84b5cc69f5
commit 75ca54cd52
3 changed files with 3 additions and 9 deletions

View file

@ -127,12 +127,6 @@ class EventBase(object):
def __set__(self, instance, value):
raise AttributeError("Unrecognized attribute %s" % (instance,))
def __getitem__(self, field):
return self._event_dict[field]
def __contains__(self, field):
return field in self._event_dict
def items(self):
return self._event_dict.items()

View file

@ -313,7 +313,7 @@ class HttpPusher(object):
if event.type == 'm.room.member':
d['notification']['membership'] = event.content['membership']
d['notification']['user_is_target'] = event.state_key == self.user_id
if self.hs.config.push_include_content and 'content' in event:
if self.hs.config.push_include_content:
d['notification']['content'] = event.content
# We no longer send aliases separately, instead, we send the human

View file

@ -122,7 +122,7 @@ class PushRuleEvaluatorForEvent(object):
# XXX: optimisation: cache our pattern regexps
if condition['key'] == 'content.body':
body = self._event["content"].get("body", None)
body = self._event.content.get("body", None)
if not body:
return False
@ -138,7 +138,7 @@ class PushRuleEvaluatorForEvent(object):
if not display_name:
return False
body = self._event["content"].get("body", None)
body = self._event.content.get("body", None)
if not body:
return False