mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
b8a3176154
commit
909d13a7fc
6
utils.py
6
utils.py
|
@ -2873,16 +2873,16 @@ def getAltPath(actor: str, domain_full: str, callingDomain: str) -> str:
|
|||
return postActor
|
||||
|
||||
|
||||
def getActorPropertyUrl(actor_json: {}, propertyName: str) -> str:
|
||||
def getActorPropertyUrl(actor_json: {}, property_name: str) -> str:
|
||||
"""Returns a url property from an actor
|
||||
"""
|
||||
if not actor_json.get('attachment'):
|
||||
return ''
|
||||
propertyName = propertyName.lower()
|
||||
property_name = property_name.lower()
|
||||
for property_value in actor_json['attachment']:
|
||||
if not property_value.get('name'):
|
||||
continue
|
||||
if not property_value['name'].lower().startswith(propertyName):
|
||||
if not property_value['name'].lower().startswith(property_name):
|
||||
continue
|
||||
if not property_value.get('type'):
|
||||
continue
|
||||
|
|
|
@ -170,13 +170,13 @@ def getContentWarningButton(postID: str, translate: {},
|
|||
'</div></details>\n'
|
||||
|
||||
|
||||
def _setActorPropertyUrl(actor_json: {}, propertyName: str, url: str) -> None:
|
||||
def _setActorPropertyUrl(actor_json: {}, property_name: str, url: str) -> None:
|
||||
"""Sets a url for the given actor property
|
||||
"""
|
||||
if not actor_json.get('attachment'):
|
||||
actor_json['attachment'] = []
|
||||
|
||||
propertyNameLower = propertyName.lower()
|
||||
property_nameLower = property_name.lower()
|
||||
|
||||
# remove any existing value
|
||||
propertyFound = None
|
||||
|
@ -185,7 +185,7 @@ def _setActorPropertyUrl(actor_json: {}, propertyName: str, url: str) -> None:
|
|||
continue
|
||||
if not property_value.get('type'):
|
||||
continue
|
||||
if not property_value['name'].lower().startswith(propertyNameLower):
|
||||
if not property_value['name'].lower().startswith(property_nameLower):
|
||||
continue
|
||||
propertyFound = property_value
|
||||
break
|
||||
|
@ -212,7 +212,7 @@ def _setActorPropertyUrl(actor_json: {}, propertyName: str, url: str) -> None:
|
|||
continue
|
||||
if not property_value.get('type'):
|
||||
continue
|
||||
if not property_value['name'].lower().startswith(propertyNameLower):
|
||||
if not property_value['name'].lower().startswith(property_nameLower):
|
||||
continue
|
||||
if property_value['type'] != 'PropertyValue':
|
||||
continue
|
||||
|
@ -220,7 +220,7 @@ def _setActorPropertyUrl(actor_json: {}, propertyName: str, url: str) -> None:
|
|||
return
|
||||
|
||||
newAddress = {
|
||||
"name": propertyName,
|
||||
"name": property_name,
|
||||
"type": "PropertyValue",
|
||||
"value": url
|
||||
}
|
||||
|
|
|
@ -364,10 +364,10 @@ def _webfingerUpdateFromProfile(wfJson: {}, actor_json: {}) -> bool:
|
|||
for property_value in actor_json['attachment']:
|
||||
if not property_value.get('name'):
|
||||
continue
|
||||
propertyName = property_value['name'].lower()
|
||||
property_name = property_value['name'].lower()
|
||||
found = False
|
||||
for name, alias in webfingerPropertyName.items():
|
||||
if name == propertyName:
|
||||
if name == property_name:
|
||||
if alias in aliasesNotFound:
|
||||
aliasesNotFound.remove(alias)
|
||||
found = True
|
||||
|
@ -388,11 +388,11 @@ def _webfingerUpdateFromProfile(wfJson: {}, actor_json: {}) -> bool:
|
|||
aliasIndex = 0
|
||||
found = False
|
||||
for alias in wfJson['aliases']:
|
||||
if alias.startswith(webfingerPropertyName[propertyName] + ':'):
|
||||
if alias.startswith(webfingerPropertyName[property_name] + ':'):
|
||||
found = True
|
||||
break
|
||||
aliasIndex += 1
|
||||
newAlias = webfingerPropertyName[propertyName] + ':' + newValue
|
||||
newAlias = webfingerPropertyName[property_name] + ':' + newValue
|
||||
if found:
|
||||
if wfJson['aliases'][aliasIndex] != newAlias:
|
||||
changed = True
|
||||
|
|
Loading…
Reference in New Issue