fediverse city

main
Bob Mottram 2021-05-17 11:27:14 +01:00
parent e2c74cdaf4
commit b60ba0431e
5 changed files with 25 additions and 31 deletions

View File

@ -288,9 +288,9 @@ def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int,
{
'@type': 'Occupation',
'name': "",
"location": {
"@type": "VirtualLocation",
"url": httpPrefix + '://' + domain
"occupationLocation": {
"@type": "City",
"name": "Fediverse"
},
'skills': []
}
@ -588,14 +588,13 @@ 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
"occupationLocation": {
"@type": "City",
"name": "Fediverse"
},
'skills': []
}
@ -614,14 +613,13 @@ 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,
'occupationLocation': {
'@type': 'VirtualLocation',
'url': personDomain
'@type': 'City',
'name': 'Fediverse'
},
'skills': []
}
@ -637,10 +635,9 @@ def personUpgradeActor(baseDir: str, personJson: {},
del ocItem['location']
updateActor = True
if not ocItem.get('occupationLocation'):
personDomain = personJson['id'].split('/users/')[0]
ocItem['occupationLocation'] = {
"@type": "VirtualLocation",
"url": personDomain
"@type": "City",
"name": "Fediverse"
}
updateActor = True

View File

@ -140,15 +140,14 @@ def _setActorRole(actorJson: {}, roleName: str) -> bool:
if occupationItem['hasOccupation']['name'] == roleName:
return True
statusNumber, published = getStatusNumber()
actorDomain = actorJson['id'].split('/users/')[0]
newRole = {
"@type": "Role",
"hasOccupation": {
"@type": "Occupation",
"name": roleName,
"occupationLocation": {
"@type": "VirtualLocation",
"url": actorDomain
"@type": "City",
"url": "Fediverse"
},
"occupationalCategory": {
"@type": "CategoryCode",

View File

@ -82,14 +82,13 @@ 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
"occupationLocation": {
"@type": "City",
"name": "Fediverse"
},
'skills': []
}

View File

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

View File

@ -725,7 +725,6 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
if isinstance(actorJson['hasOccupation'], list):
skillsMarkup = ' "hasOccupation": [\n'
firstEntry = True
actorDomain = actorJson['id'].split('/users/')[0]
for skillDict in actorJson['hasOccupation']:
if skillDict['@type'] == 'Role':
if not firstEntry:
@ -745,9 +744,9 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
skillsMarkup += ' "name": "' + roleName + '",\n'
skillsMarkup += ' "occupationLocation": {\n'
skillsMarkup += \
' "@type": "VirtualLocation",\n'
' "@type": "City",\n'
skillsMarkup += \
' "url": "' + actorDomain + '"\n'
' "name": "' + city + '"\n'
skillsMarkup += ' },\n'
skillsMarkup += ' "occupationalCategory": {\n'
skillsMarkup += ' "@type": "CategoryCode",\n'
@ -784,9 +783,9 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
skillsMarkup += ' "@type": "Occupation",\n'
skillsMarkup += ' "name": "' + ocName + '",\n'
skillsMarkup += ' "occupationLocation": {\n'
skillsMarkup += ' "@type": "VirtualLocation",\n'
skillsMarkup += ' "@type": "City",\n'
skillsMarkup += \
' "url": "' + actorDomain + '"\n'
' "name": "' + city + '"\n'
skillsMarkup += ' },\n'
skillsMarkup += \
' "skills": ' + skillsListStr + '\n'