瀏覽代碼

[scrobbles] Fix dataclass dict converstion error

Colin Powell 14 小時之前
父節點
當前提交
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):