mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 10:01:04 +00:00
Use None instead of empty dict for endpoint default value
This commit is contained in:
parent
0d8e1f0ae2
commit
ba09377041
2 changed files with 3 additions and 3 deletions
|
@ -24,7 +24,7 @@ class Person(ActivityObject):
|
|||
outbox: str
|
||||
followers: str
|
||||
publicKey: PublicKey
|
||||
endpoints: Dict = field(default_factory=lambda: {})
|
||||
endpoints: Dict = None
|
||||
name: str = None
|
||||
summary: str = None
|
||||
icon: Image = field(default_factory=lambda: {})
|
||||
|
|
|
@ -73,7 +73,7 @@ class ActivitypubFieldMixin:
|
|||
raise
|
||||
value = getattr(data, "actor")
|
||||
formatted = self.field_from_activity(value)
|
||||
if formatted is None or formatted is MISSING:
|
||||
if formatted is None or formatted is MISSING or formatted == {}:
|
||||
return
|
||||
setattr(instance, self.name, formatted)
|
||||
|
||||
|
@ -101,7 +101,7 @@ class ActivitypubFieldMixin:
|
|||
|
||||
def field_from_activity(self, value):
|
||||
""" formatter to convert activitypub into a model value """
|
||||
if hasattr(self, "activitypub_wrapper"):
|
||||
if value and hasattr(self, "activitypub_wrapper"):
|
||||
value = value.get(self.activitypub_wrapper)
|
||||
return value
|
||||
|
||||
|
|
Loading…
Reference in a new issue