fix bug in models.reset_protocol_properties

added in eaa4e5333a
pull/525/head
Ryan Barrett 2023-05-26 16:36:45 -07:00
rodzic eaa4e5333a
commit 51fd119c02
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
3 zmienionych plików z 14 dodań i 3 usunięć

Wyświetl plik

@ -59,8 +59,10 @@ class ProtocolUserMeta(type(ndb.Model)):
def reset_protocol_properties():
"""Recreates various protocol properties to include choices PROTOCOLS."""
Target.protocol = ndb.StringProperty(choices=list(PROTOCOLS.keys()), required=True)
Object.source_protocol = ndb.StringProperty(choices=list(PROTOCOLS.keys()))
Target.protocol = ndb.StringProperty(
'protocol', choices=list(PROTOCOLS.keys()), required=True)
Object.source_protocol = ndb.StringProperty(
'source_protocol', choices=list(PROTOCOLS.keys()))
def base64_to_long(x):

Wyświetl plik

@ -286,6 +286,11 @@ def nodeinfo():
"""
https://nodeinfo.diaspora.software/schema.html
"""
user_total = None
stat = KindStat.query(KindStat.kind_name == 'MagicKey').get()
if stat:
user_total = stat.count
return {
'version': '2.1',
'software': {
@ -305,7 +310,7 @@ def nodeinfo():
},
'usage': {
'users': {
'total': KindStat.query(KindStat.kind_name == 'MagicKey').get().count,
'total': user_total,
# 'activeMonth':
# 'activeHalfyear':
},

Wyświetl plik

@ -226,3 +226,7 @@ class PagesTest(TestCase):
got = self.client.get('/user/user.com/feed?format=rss')
self.assert_equals(200, got.status_code)
self.assert_equals(self.EXPECTED, contents(rss.to_activities(got.text)))
def test_nodeinfo(self):
# just check that it doesn't crash
self.client.get('/nodeinfo.json')