Sfoglia il codice sorgente

[scrobbles] Fix dataclass dict converstion error

Colin Powell 14 ore fa
parent
commit
7309181fed
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  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):