summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorAdrian Tschira <nota@notafile.com>2018-04-30 09:49:10 +0200
committerAdrian Tschira <nota@notafile.com>2018-04-30 09:49:10 +0200
commit0c9db26260210bd2066048333b2644a2511b1801 (patch)
treecaf49621376c7b0b5998b391e9f325a1d13e3733 /synapse/events
parentMake event properties raise AttributeError instead (diff)
downloadsynapse-0c9db26260210bd2066048333b2644a2511b1801.tar.xz
add comment explaining attributeerror
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py
index d4d1b92f7a..c3ff85c49a 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]