From 0c9db26260210bd2066048333b2644a2511b1801 Mon Sep 17 00:00:00 2001 From: Adrian Tschira Date: Mon, 30 Apr 2018 09:49:10 +0200 Subject: [PATCH] add comment explaining attributeerror --- synapse/events/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py index d4d1b92f7..c3ff85c49 100644 --- a/synapse/events/__init__.py +++ b/synapse/events/__init__.py @@ -47,6 +47,9 @@ class _EventInternalMetadata(object): def _event_dict_property(key): + # We want to be able to use hasattr with the event dict properties. + # However, (on python3) hasattr expects AttributeError to be raised. Hence, + # we need to transform the KeyError into an AttributeError def getter(self): try: return self._event_dict[key]