Set locations for roles

main
Bob Mottram 2021-05-17 10:12:10 +01:00
parent 8d6e5812be
commit 3dc34bd77d
3 changed files with 27 additions and 0 deletions

View File

@ -288,6 +288,10 @@ def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int,
{
'@type': 'Occupation',
'name': "",
"location": {
"@type": "VirtualLocation",
"url": httpPrefix + '://' + domain
},
'skills': []
}
],
@ -584,10 +588,15 @@ def personUpgradeActor(baseDir: str, personJson: {},
# if the older skills format is being used then switch
# to the new one
if not personJson.get('hasOccupation'):
personDomain = personJson['id'].split('/users/')[0]
personJson['hasOccupation'] = [
{
'@type': 'Occupation',
'name': occupationName,
"location": {
"@type": "VirtualLocation",
"url": personDomain
},
'skills': []
}
]
@ -605,10 +614,15 @@ def personUpgradeActor(baseDir: str, personJson: {},
updateActor = True
if not isinstance(personJson['hasOccupation'], list):
personDomain = personJson['id'].split('/users/')[0]
personJson['hasOccupation'] = [
{
'@type': 'Occupation',
'name': occupationName,
"location": {
"@type": "VirtualLocation",
"url": personDomain
},
'skills': []
}
]

View File

@ -82,10 +82,15 @@ def setActorSkillLevel(actorJson: {},
if not actorJson:
return True
if not actorJson.get('hasOccupation'):
actorDomain = actorJson['id'].split('/users/')[0]
actorJson['hasOccupation'] = [
{
'@type': 'Occupation',
'name': '',
"location": {
"@type": "VirtualLocation",
"url": actorDomain
},
'skills': []
}
]

View File

@ -3666,6 +3666,10 @@ def testSkills() -> None:
{
'@type': 'Occupation',
'name': "Sysop",
"location": {
"@type": "VirtualLocation",
"url": "https://jazzy.hedgehog"
},
'skills': []
}
]
@ -3688,6 +3692,10 @@ def testRoles() -> None:
{
'@type': 'Occupation',
'name': "Sysop",
"location": {
"@type": "VirtualLocation",
"url": "https://mostly.giraffe"
},
'skills': []
}
]