Преглед на файлове

add comment explaining attributeerror

Adrian Tschira преди 6 години
родител
ревизия
0c9db26260
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 3 0
      synapse/events/__init__.py

+ 3 - 0
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]