try not clearing Object.bsky

now that we're starting to replace copies with originals in ids, actors, etc, it'd be nice to preserve the original source object data.
pull/691/head
Ryan Barrett 2023-10-17 16:19:29 -07:00
rodzic 96b84511eb
commit ff88c082ef
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 7 dodań i 5 usunięć

Wyświetl plik

@ -757,7 +757,7 @@ class Object(StringIdModel):
obj = Object(id=id)
obj.new = True
if set(props.keys()) & set(('our_as1', 'as2', 'mf2', 'bsky', 'raw')):
if set(props.keys()) & set(('our_as1', 'as2', 'mf2', 'raw')):
obj.clear()
obj.populate(**{
k: v for k, v in props.items()
@ -796,8 +796,11 @@ class Object(StringIdModel):
getattr(self, prop).remove(val)
def clear(self):
"""Clears all data properties."""
for prop in 'our_as1', 'as2', 'bsky', 'mf2', 'raw':
"""Clears all data properties.
TODO: remove?
"""
for prop in 'our_as1', 'as2', 'mf2', 'raw':
val = getattr(self, prop, None)
# TODO: delete entirely?
# if val:

Wyświetl plik

@ -659,12 +659,11 @@ class ObjectTest(TestCase):
def test_clear(self):
ab = {'a': 'b'}
obj = Object(our_as1=ab, as2=ab, mf2=ab, bsky=ab)
obj = Object(our_as1=ab, as2=ab, mf2=ab)
obj.clear()
self.assertIsNone(obj.our_as1)
self.assertIsNone(obj.as2)
self.assertIsNone(obj.mf2)
self.assertIsNone(obj.bsky)
def test_validate_id(self):
# DID repo ids