mirror of https://gitlab.com/bashrc2/epicyon
Simplify
parent
b27fa065b4
commit
9c6db7be11
|
@ -4839,11 +4839,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# change website
|
# change website
|
||||||
currentWebsite = \
|
currentWebsite = \
|
||||||
getWebsite(actorJson, self.server.translate)
|
getWebsite(actorJson, self.server.translate)
|
||||||
print('websiteUrl: 0')
|
|
||||||
if fields.get('websiteUrl'):
|
if fields.get('websiteUrl'):
|
||||||
print('websiteUrl: 1 ' + fields['websiteUrl'])
|
|
||||||
if fields['websiteUrl'] != currentWebsite:
|
if fields['websiteUrl'] != currentWebsite:
|
||||||
print('websiteUrl: 2 ' + fields['websiteUrl'])
|
|
||||||
setWebsite(actorJson,
|
setWebsite(actorJson,
|
||||||
fields['websiteUrl'],
|
fields['websiteUrl'],
|
||||||
self.server.translate)
|
self.server.translate)
|
||||||
|
|
19
donate.py
19
donate.py
|
@ -49,7 +49,7 @@ def getWebsite(actorJson: {}, translate: {}) -> str:
|
||||||
if not actorJson.get('attachment'):
|
if not actorJson.get('attachment'):
|
||||||
return ''
|
return ''
|
||||||
matchStrings = _getWebsiteStrings()
|
matchStrings = _getWebsiteStrings()
|
||||||
matchStrings.append(translate['Website'])
|
matchStrings.append(translate['Website'].lower())
|
||||||
for propertyValue in actorJson['attachment']:
|
for propertyValue in actorJson['attachment']:
|
||||||
if not propertyValue.get('name'):
|
if not propertyValue.get('name'):
|
||||||
continue
|
continue
|
||||||
|
@ -133,6 +133,7 @@ def setDonationUrl(actorJson: {}, donateUrl: str) -> None:
|
||||||
def setWebsite(actorJson: {}, websiteUrl: str, translate: {}) -> None:
|
def setWebsite(actorJson: {}, websiteUrl: str, translate: {}) -> None:
|
||||||
"""Sets a web address
|
"""Sets a web address
|
||||||
"""
|
"""
|
||||||
|
websiteUrl = websiteUrl.strip()
|
||||||
notUrl = False
|
notUrl = False
|
||||||
if '.' not in websiteUrl:
|
if '.' not in websiteUrl:
|
||||||
notUrl = True
|
notUrl = True
|
||||||
|
@ -147,7 +148,7 @@ def setWebsite(actorJson: {}, websiteUrl: str, translate: {}) -> None:
|
||||||
actorJson['attachment'] = []
|
actorJson['attachment'] = []
|
||||||
|
|
||||||
matchStrings = _getWebsiteStrings()
|
matchStrings = _getWebsiteStrings()
|
||||||
matchStrings.append(translate['Website'])
|
matchStrings.append(translate['Website'].lower())
|
||||||
|
|
||||||
# remove any existing value
|
# remove any existing value
|
||||||
propertyFound = None
|
propertyFound = None
|
||||||
|
@ -156,7 +157,7 @@ def setWebsite(actorJson: {}, websiteUrl: str, translate: {}) -> None:
|
||||||
continue
|
continue
|
||||||
if not propertyValue.get('type'):
|
if not propertyValue.get('type'):
|
||||||
continue
|
continue
|
||||||
if not propertyValue['name'].lower() not in matchStrings:
|
if propertyValue['name'].lower() not in matchStrings:
|
||||||
continue
|
continue
|
||||||
propertyFound = propertyValue
|
propertyFound = propertyValue
|
||||||
break
|
break
|
||||||
|
@ -165,18 +166,6 @@ def setWebsite(actorJson: {}, websiteUrl: str, translate: {}) -> None:
|
||||||
if notUrl:
|
if notUrl:
|
||||||
return
|
return
|
||||||
|
|
||||||
for propertyValue in actorJson['attachment']:
|
|
||||||
if not propertyValue.get('name'):
|
|
||||||
continue
|
|
||||||
if not propertyValue.get('type'):
|
|
||||||
continue
|
|
||||||
if not propertyValue['name'].lower() not in matchStrings:
|
|
||||||
continue
|
|
||||||
if propertyValue['type'] != 'PropertyValue':
|
|
||||||
continue
|
|
||||||
propertyValue['value'] = websiteUrl
|
|
||||||
return
|
|
||||||
|
|
||||||
newEntry = {
|
newEntry = {
|
||||||
"name": 'Website',
|
"name": 'Website',
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
|
|
Loading…
Reference in New Issue