kopia lustrzana https://github.com/snarfed/bridgy-fed
Object.type and object_ids fixes to handle missing as1
fixes https://console.cloud.google.com/errors/detail/CJ-U7Zq_s4bxgwE;time=P30D?project=bridgy-federatedpull/434/head
rodzic
42c648284d
commit
aa483ded0b
|
@ -301,10 +301,12 @@ class Object(StringIdModel):
|
|||
|
||||
@ndb.ComputedProperty
|
||||
def type(self): # AS1 objectType, or verb if it's an activity
|
||||
return as1.object_type(self.as1)
|
||||
if self.as1:
|
||||
return as1.object_type(self.as1)
|
||||
|
||||
def _object_ids(self): # id(s) of inner objects
|
||||
return as1.get_ids(self.as1, 'object')
|
||||
if self.as1:
|
||||
return as1.get_ids(self.as1, 'object')
|
||||
object_ids = ndb.ComputedProperty(_object_ids, repeated=True)
|
||||
|
||||
deleted = ndb.BooleanProperty()
|
||||
|
|
|
@ -294,6 +294,9 @@ class ObjectTest(testutil.TestCase):
|
|||
self.assertNotIn(common.get_object.cache_key('x#y'), common.get_object.cache)
|
||||
self.assertNotIn(common.get_object.cache_key('x'), common.get_object.cache)
|
||||
|
||||
def test_computed_properties_without_as1(self):
|
||||
Object(id='a').put()
|
||||
|
||||
|
||||
class FollowerTest(testutil.TestCase):
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue