mirror of https://gitlab.com/bashrc2/epicyon
fediverse city
parent
e2c74cdaf4
commit
b60ba0431e
23
person.py
23
person.py
|
@ -288,9 +288,9 @@ def _createPersonBase(baseDir: str, nickname: str, domain: str, port: int,
|
||||||
{
|
{
|
||||||
'@type': 'Occupation',
|
'@type': 'Occupation',
|
||||||
'name': "",
|
'name': "",
|
||||||
"location": {
|
"occupationLocation": {
|
||||||
"@type": "VirtualLocation",
|
"@type": "City",
|
||||||
"url": httpPrefix + '://' + domain
|
"name": "Fediverse"
|
||||||
},
|
},
|
||||||
'skills': []
|
'skills': []
|
||||||
}
|
}
|
||||||
|
@ -588,14 +588,13 @@ def personUpgradeActor(baseDir: str, personJson: {},
|
||||||
# if the older skills format is being used then switch
|
# if the older skills format is being used then switch
|
||||||
# to the new one
|
# to the new one
|
||||||
if not personJson.get('hasOccupation'):
|
if not personJson.get('hasOccupation'):
|
||||||
personDomain = personJson['id'].split('/users/')[0]
|
|
||||||
personJson['hasOccupation'] = [
|
personJson['hasOccupation'] = [
|
||||||
{
|
{
|
||||||
'@type': 'Occupation',
|
'@type': 'Occupation',
|
||||||
'name': occupationName,
|
'name': occupationName,
|
||||||
"location": {
|
"occupationLocation": {
|
||||||
"@type": "VirtualLocation",
|
"@type": "City",
|
||||||
"url": personDomain
|
"name": "Fediverse"
|
||||||
},
|
},
|
||||||
'skills': []
|
'skills': []
|
||||||
}
|
}
|
||||||
|
@ -614,14 +613,13 @@ def personUpgradeActor(baseDir: str, personJson: {},
|
||||||
updateActor = True
|
updateActor = True
|
||||||
|
|
||||||
if not isinstance(personJson['hasOccupation'], list):
|
if not isinstance(personJson['hasOccupation'], list):
|
||||||
personDomain = personJson['id'].split('/users/')[0]
|
|
||||||
personJson['hasOccupation'] = [
|
personJson['hasOccupation'] = [
|
||||||
{
|
{
|
||||||
'@type': 'Occupation',
|
'@type': 'Occupation',
|
||||||
'name': occupationName,
|
'name': occupationName,
|
||||||
'occupationLocation': {
|
'occupationLocation': {
|
||||||
'@type': 'VirtualLocation',
|
'@type': 'City',
|
||||||
'url': personDomain
|
'name': 'Fediverse'
|
||||||
},
|
},
|
||||||
'skills': []
|
'skills': []
|
||||||
}
|
}
|
||||||
|
@ -637,10 +635,9 @@ def personUpgradeActor(baseDir: str, personJson: {},
|
||||||
del ocItem['location']
|
del ocItem['location']
|
||||||
updateActor = True
|
updateActor = True
|
||||||
if not ocItem.get('occupationLocation'):
|
if not ocItem.get('occupationLocation'):
|
||||||
personDomain = personJson['id'].split('/users/')[0]
|
|
||||||
ocItem['occupationLocation'] = {
|
ocItem['occupationLocation'] = {
|
||||||
"@type": "VirtualLocation",
|
"@type": "City",
|
||||||
"url": personDomain
|
"name": "Fediverse"
|
||||||
}
|
}
|
||||||
updateActor = True
|
updateActor = True
|
||||||
|
|
||||||
|
|
5
roles.py
5
roles.py
|
@ -140,15 +140,14 @@ def _setActorRole(actorJson: {}, roleName: str) -> bool:
|
||||||
if occupationItem['hasOccupation']['name'] == roleName:
|
if occupationItem['hasOccupation']['name'] == roleName:
|
||||||
return True
|
return True
|
||||||
statusNumber, published = getStatusNumber()
|
statusNumber, published = getStatusNumber()
|
||||||
actorDomain = actorJson['id'].split('/users/')[0]
|
|
||||||
newRole = {
|
newRole = {
|
||||||
"@type": "Role",
|
"@type": "Role",
|
||||||
"hasOccupation": {
|
"hasOccupation": {
|
||||||
"@type": "Occupation",
|
"@type": "Occupation",
|
||||||
"name": roleName,
|
"name": roleName,
|
||||||
"occupationLocation": {
|
"occupationLocation": {
|
||||||
"@type": "VirtualLocation",
|
"@type": "City",
|
||||||
"url": actorDomain
|
"url": "Fediverse"
|
||||||
},
|
},
|
||||||
"occupationalCategory": {
|
"occupationalCategory": {
|
||||||
"@type": "CategoryCode",
|
"@type": "CategoryCode",
|
||||||
|
|
|
@ -82,14 +82,13 @@ def setActorSkillLevel(actorJson: {},
|
||||||
if not actorJson:
|
if not actorJson:
|
||||||
return True
|
return True
|
||||||
if not actorJson.get('hasOccupation'):
|
if not actorJson.get('hasOccupation'):
|
||||||
actorDomain = actorJson['id'].split('/users/')[0]
|
|
||||||
actorJson['hasOccupation'] = [
|
actorJson['hasOccupation'] = [
|
||||||
{
|
{
|
||||||
'@type': 'Occupation',
|
'@type': 'Occupation',
|
||||||
'name': '',
|
'name': '',
|
||||||
"location": {
|
"occupationLocation": {
|
||||||
"@type": "VirtualLocation",
|
"@type": "City",
|
||||||
"url": actorDomain
|
"name": "Fediverse"
|
||||||
},
|
},
|
||||||
'skills': []
|
'skills': []
|
||||||
}
|
}
|
||||||
|
|
12
tests.py
12
tests.py
|
@ -3666,9 +3666,9 @@ def testSkills() -> None:
|
||||||
{
|
{
|
||||||
'@type': 'Occupation',
|
'@type': 'Occupation',
|
||||||
'name': "Sysop",
|
'name': "Sysop",
|
||||||
"location": {
|
"occupationLocation": {
|
||||||
"@type": "VirtualLocation",
|
"@type": "City",
|
||||||
"url": "https://jazzy.hedgehog"
|
"name": "Fediverse"
|
||||||
},
|
},
|
||||||
'skills': []
|
'skills': []
|
||||||
}
|
}
|
||||||
|
@ -3692,9 +3692,9 @@ def testRoles() -> None:
|
||||||
{
|
{
|
||||||
'@type': 'Occupation',
|
'@type': 'Occupation',
|
||||||
'name': "Sysop",
|
'name': "Sysop",
|
||||||
"location": {
|
'occupationLocation': {
|
||||||
"@type": "VirtualLocation",
|
'@type': 'City',
|
||||||
"url": "https://mostly.giraffe"
|
'name': 'Fediverse'
|
||||||
},
|
},
|
||||||
'skills': []
|
'skills': []
|
||||||
}
|
}
|
||||||
|
|
|
@ -725,7 +725,6 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
|
||||||
if isinstance(actorJson['hasOccupation'], list):
|
if isinstance(actorJson['hasOccupation'], list):
|
||||||
skillsMarkup = ' "hasOccupation": [\n'
|
skillsMarkup = ' "hasOccupation": [\n'
|
||||||
firstEntry = True
|
firstEntry = True
|
||||||
actorDomain = actorJson['id'].split('/users/')[0]
|
|
||||||
for skillDict in actorJson['hasOccupation']:
|
for skillDict in actorJson['hasOccupation']:
|
||||||
if skillDict['@type'] == 'Role':
|
if skillDict['@type'] == 'Role':
|
||||||
if not firstEntry:
|
if not firstEntry:
|
||||||
|
@ -745,9 +744,9 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
|
||||||
skillsMarkup += ' "name": "' + roleName + '",\n'
|
skillsMarkup += ' "name": "' + roleName + '",\n'
|
||||||
skillsMarkup += ' "occupationLocation": {\n'
|
skillsMarkup += ' "occupationLocation": {\n'
|
||||||
skillsMarkup += \
|
skillsMarkup += \
|
||||||
' "@type": "VirtualLocation",\n'
|
' "@type": "City",\n'
|
||||||
skillsMarkup += \
|
skillsMarkup += \
|
||||||
' "url": "' + actorDomain + '"\n'
|
' "name": "' + city + '"\n'
|
||||||
skillsMarkup += ' },\n'
|
skillsMarkup += ' },\n'
|
||||||
skillsMarkup += ' "occupationalCategory": {\n'
|
skillsMarkup += ' "occupationalCategory": {\n'
|
||||||
skillsMarkup += ' "@type": "CategoryCode",\n'
|
skillsMarkup += ' "@type": "CategoryCode",\n'
|
||||||
|
@ -784,9 +783,9 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
|
||||||
skillsMarkup += ' "@type": "Occupation",\n'
|
skillsMarkup += ' "@type": "Occupation",\n'
|
||||||
skillsMarkup += ' "name": "' + ocName + '",\n'
|
skillsMarkup += ' "name": "' + ocName + '",\n'
|
||||||
skillsMarkup += ' "occupationLocation": {\n'
|
skillsMarkup += ' "occupationLocation": {\n'
|
||||||
skillsMarkup += ' "@type": "VirtualLocation",\n'
|
skillsMarkup += ' "@type": "City",\n'
|
||||||
skillsMarkup += \
|
skillsMarkup += \
|
||||||
' "url": "' + actorDomain + '"\n'
|
' "name": "' + city + '"\n'
|
||||||
skillsMarkup += ' },\n'
|
skillsMarkup += ' },\n'
|
||||||
skillsMarkup += \
|
skillsMarkup += \
|
||||||
' "skills": ' + skillsListStr + '\n'
|
' "skills": ' + skillsListStr + '\n'
|
||||||
|
|
Loading…
Reference in New Issue