mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
4387e21ba4
commit
ba6320e3f5
|
@ -265,7 +265,7 @@ from utils import permitted_dir
|
|||
from utils import is_account_dir
|
||||
from utils import getOccupationSkills
|
||||
from utils import getOccupationName
|
||||
from utils import setOccupationName
|
||||
from utils import set_occupation_name
|
||||
from utils import loadTranslationsFromFile
|
||||
from utils import getLocalNetworkAddresses
|
||||
from utils import decoded_host
|
||||
|
@ -5479,12 +5479,12 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
removeHtml(fields['occupationName'])
|
||||
if occupationName != \
|
||||
fields['occupationName']:
|
||||
setOccupationName(actor_json,
|
||||
fields['occupationName'])
|
||||
set_occupation_name(actor_json,
|
||||
fields['occupationName'])
|
||||
actorChanged = True
|
||||
else:
|
||||
if occupationName:
|
||||
setOccupationName(actor_json, '')
|
||||
set_occupation_name(actor_json, '')
|
||||
actorChanged = True
|
||||
|
||||
# Other accounts (alsoKnownAs)
|
||||
|
|
12
utils.py
12
utils.py
|
@ -2765,7 +2765,7 @@ def getOccupationName(actor_json: {}) -> str:
|
|||
return ""
|
||||
|
||||
|
||||
def setOccupationName(actor_json: {}, name: str) -> bool:
|
||||
def set_occupation_name(actor_json: {}, name: str) -> bool:
|
||||
"""Sets the occupation name of an actor
|
||||
"""
|
||||
if not actor_json.get('hasOccupation'):
|
||||
|
@ -2773,14 +2773,14 @@ def setOccupationName(actor_json: {}, name: str) -> bool:
|
|||
if not isinstance(actor_json['hasOccupation'], list):
|
||||
return False
|
||||
for index in range(len(actor_json['hasOccupation'])):
|
||||
occupationItem = actor_json['hasOccupation'][index]
|
||||
if not isinstance(occupationItem, dict):
|
||||
occupation_item = actor_json['hasOccupation'][index]
|
||||
if not isinstance(occupation_item, dict):
|
||||
continue
|
||||
if not occupationItem.get('@type'):
|
||||
if not occupation_item.get('@type'):
|
||||
continue
|
||||
if occupationItem['@type'] != 'Occupation':
|
||||
if occupation_item['@type'] != 'Occupation':
|
||||
continue
|
||||
occupationItem['name'] = name
|
||||
occupation_item['name'] = name
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
Loading…
Reference in New Issue