kopia lustrzana https://github.com/snarfed/bridgy-fed
rodzic
374354a21f
commit
99bb564209
12
models.py
12
models.py
|
@ -97,12 +97,8 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
|
|||
created = ndb.DateTimeProperty(auto_now_add=True)
|
||||
updated = ndb.DateTimeProperty(auto_now=True)
|
||||
|
||||
@ndb.ComputedProperty
|
||||
def actor_as2(self):
|
||||
return self.as2()
|
||||
|
||||
# OLD. some stored entities still have this; do not reuse.
|
||||
old_actor_as2 = JsonProperty(name='actor_as2')
|
||||
# actor_as2 = JsonProperty()
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
"""Constructor.
|
||||
|
@ -203,8 +199,10 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
|
|||
u._obj = keys_to_objs.get(u.obj_key)
|
||||
|
||||
def as2(self):
|
||||
return (as2.from_as1(self.obj.as1) if self.obj and self.obj.as1
|
||||
else self.old_actor_as2)
|
||||
if self.obj and self.obj.as1:
|
||||
return self.obj.as2 or as2.from_as1(self.obj.as1)
|
||||
|
||||
return {}
|
||||
|
||||
@ndb.ComputedProperty
|
||||
def readable_id(self):
|
||||
|
|
|
@ -313,8 +313,8 @@ class TestCase(unittest.TestCase, testutil.Asserts):
|
|||
self.assert_equals(obj_as2, got.as2())
|
||||
|
||||
# generated, computed, etc
|
||||
ignore = ['created', 'mod', 'obj_key', 'old_actor_as2', 'p256_key',
|
||||
'private_exponent', 'public_exponent', 'readable_id', 'updated']
|
||||
ignore = ['created', 'mod', 'obj_key', 'p256_key', 'private_exponent',
|
||||
'public_exponent', 'readable_id', 'updated']
|
||||
for prop in ignore:
|
||||
assert prop not in props
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue