forked from indymedia/epicyon
Upgrade actor with nomadic locations
parent
5c2905d57d
commit
d30d519d22
15
person.py
15
person.py
|
@ -373,6 +373,20 @@ def createCapabilitiesInbox(baseDir: str,nickname: str,domain: str,port: int, \
|
||||||
"""
|
"""
|
||||||
return createPersonBase(baseDir,nickname,domain,port,httpPrefix,True,None)
|
return createPersonBase(baseDir,nickname,domain,port,httpPrefix,True,None)
|
||||||
|
|
||||||
|
def personUpgradeActor(personJson: {},handle: str,filename: str) -> None:
|
||||||
|
"""Alter the actor to add any new properties
|
||||||
|
"""
|
||||||
|
if not personJson.get('nomadicLocations'):
|
||||||
|
personJson['nomadicLocations']=[{
|
||||||
|
'id': personJson['id'],
|
||||||
|
'type': 'nomadicLocation',
|
||||||
|
'locationAddress':'acct:'+handle,
|
||||||
|
'locationPrimary':True,
|
||||||
|
'locationDeleted':False
|
||||||
|
}]
|
||||||
|
saveJson(personJson,filename)
|
||||||
|
print('Nomadic locations added to to actor '+handle)
|
||||||
|
|
||||||
def personLookup(domain: str,path: str,baseDir: str) -> {}:
|
def personLookup(domain: str,path: str,baseDir: str) -> {}:
|
||||||
"""Lookup the person for an given nickname
|
"""Lookup the person for an given nickname
|
||||||
"""
|
"""
|
||||||
|
@ -407,6 +421,7 @@ def personLookup(domain: str,path: str,baseDir: str) -> {}:
|
||||||
if not os.path.isfile(filename):
|
if not os.path.isfile(filename):
|
||||||
return None
|
return None
|
||||||
personJson=loadJson(filename)
|
personJson=loadJson(filename)
|
||||||
|
personUpgradeActor(personJson,handle,filename)
|
||||||
#if not personJson:
|
#if not personJson:
|
||||||
# personJson={"user": "unknown"}
|
# personJson={"user": "unknown"}
|
||||||
return personJson
|
return personJson
|
||||||
|
|
Loading…
Reference in New Issue