mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
ba6320e3f5
commit
467c5831a4
|
@ -264,7 +264,7 @@ from utils import isLocalNetworkAddress
|
||||||
from utils import permitted_dir
|
from utils import permitted_dir
|
||||||
from utils import is_account_dir
|
from utils import is_account_dir
|
||||||
from utils import getOccupationSkills
|
from utils import getOccupationSkills
|
||||||
from utils import getOccupationName
|
from utils import get_occupation_name
|
||||||
from utils import set_occupation_name
|
from utils import set_occupation_name
|
||||||
from utils import loadTranslationsFromFile
|
from utils import loadTranslationsFromFile
|
||||||
from utils import getLocalNetworkAddresses
|
from utils import getLocalNetworkAddresses
|
||||||
|
@ -5473,7 +5473,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
actorChanged = True
|
actorChanged = True
|
||||||
|
|
||||||
# Other accounts (alsoKnownAs)
|
# Other accounts (alsoKnownAs)
|
||||||
occupationName = getOccupationName(actor_json)
|
occupationName = get_occupation_name(actor_json)
|
||||||
if fields.get('occupationName'):
|
if fields.get('occupationName'):
|
||||||
fields['occupationName'] = \
|
fields['occupationName'] = \
|
||||||
removeHtml(fields['occupationName'])
|
removeHtml(fields['occupationName'])
|
||||||
|
|
16
utils.py
16
utils.py
|
@ -2743,24 +2743,24 @@ def getOccupationSkills(actor_json: {}) -> []:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def getOccupationName(actor_json: {}) -> str:
|
def get_occupation_name(actor_json: {}) -> str:
|
||||||
"""Returns the occupation name an actor
|
"""Returns the occupation name an actor
|
||||||
"""
|
"""
|
||||||
if not actor_json.get('hasOccupation'):
|
if not actor_json.get('hasOccupation'):
|
||||||
return ""
|
return ""
|
||||||
if not isinstance(actor_json['hasOccupation'], list):
|
if not isinstance(actor_json['hasOccupation'], list):
|
||||||
return ""
|
return ""
|
||||||
for occupationItem in actor_json['hasOccupation']:
|
for occupation_item in actor_json['hasOccupation']:
|
||||||
if not isinstance(occupationItem, dict):
|
if not isinstance(occupation_item, dict):
|
||||||
continue
|
continue
|
||||||
if not occupationItem.get('@type'):
|
if not occupation_item.get('@type'):
|
||||||
continue
|
continue
|
||||||
if occupationItem['@type'] != 'Occupation':
|
if occupation_item['@type'] != 'Occupation':
|
||||||
continue
|
continue
|
||||||
if not occupationItem.get('name'):
|
if not occupation_item.get('name'):
|
||||||
continue
|
continue
|
||||||
if isinstance(occupationItem['name'], str):
|
if isinstance(occupation_item['name'], str):
|
||||||
return occupationItem['name']
|
return occupation_item['name']
|
||||||
break
|
break
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ from webfinger import webfingerHandle
|
||||||
from utils import getDisplayName
|
from utils import getDisplayName
|
||||||
from utils import is_group_account
|
from utils import is_group_account
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
from utils import getOccupationName
|
from utils import get_occupation_name
|
||||||
from utils import get_locked_account
|
from utils import get_locked_account
|
||||||
from utils import get_full_domain
|
from utils import get_full_domain
|
||||||
from utils import is_artist
|
from utils import is_artist
|
||||||
|
@ -824,7 +824,7 @@ def htmlProfile(signing_priv_key_pem: str,
|
||||||
joinedDate = profile_json['published']
|
joinedDate = profile_json['published']
|
||||||
occupationName = None
|
occupationName = None
|
||||||
if profile_json.get('hasOccupation'):
|
if profile_json.get('hasOccupation'):
|
||||||
occupationName = getOccupationName(profile_json)
|
occupationName = get_occupation_name(profile_json)
|
||||||
|
|
||||||
avatarUrl = profile_json['icon']['url']
|
avatarUrl = profile_json['icon']['url']
|
||||||
# use alternate path for local avatars to avoid any caching issues
|
# use alternate path for local avatars to avoid any caching issues
|
||||||
|
@ -2008,7 +2008,7 @@ def _htmlEditProfileMain(base_dir: str, displayNickname: str, bioStr: str,
|
||||||
|
|
||||||
occupationName = ''
|
occupationName = ''
|
||||||
if actor_json.get('hasOccupation'):
|
if actor_json.get('hasOccupation'):
|
||||||
occupationName = getOccupationName(actor_json)
|
occupationName = get_occupation_name(actor_json)
|
||||||
|
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
editTextField(translate['Occupation'], 'occupationName',
|
editTextField(translate['Occupation'], 'occupationName',
|
||||||
|
|
Loading…
Reference in New Issue