Просмотр исходного кода

[scrobbles] Fix dataclass dict converstion error

Colin Powell 14 часов назад
Родитель
Сommit
7309181fed
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      vrobbler/apps/scrobbles/dataclasses.py

+ 4 - 1
vrobbler/apps/scrobbles/dataclasses.py

@@ -13,7 +13,10 @@ User = get_user_model()
 
 class ScrobbleLogDataEncoder(json.JSONEncoder):
     def default(self, o):
-        return o.__dict__
+        try:
+            return o.__dict__
+        except AttributeError:
+            return {}
 
 
 class ScrobbleLogDataDecoder(json.JSONDecoder):