Prepare for alternative property value

merge-requests/30/head
Bob Mottram 2022-05-11 17:16:34 +01:00
parent 6033fca4d4
commit 5b02a22519
12 changed files with 27 additions and 27 deletions

View File

@ -27,7 +27,7 @@ def get_briar_address(actor_json: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = property_value['value'].strip()
if len(property_value['value']) < 50:
@ -106,7 +106,7 @@ def set_briar_address(actor_json: {}, briar_address: str) -> None:
continue
if not name_value.lower().startswith('briar'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = briar_address
return

View File

@ -29,7 +29,7 @@ def get_cwtch_address(actor_json: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = property_value['value'].strip()
if len(property_value['value']) < 2:
@ -94,7 +94,7 @@ def set_cwtch_address(actor_json: {}, cwtch_address: str) -> None:
continue
if not name_value.lower().startswith('cwtch'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = cwtch_address
return

View File

@ -38,7 +38,7 @@ def get_donation_url(actor_json: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
if '<a href="' not in property_value['value']:
continue
@ -69,7 +69,7 @@ def get_website(actor_json: {}, translate: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
return property_value['value']
return ''
@ -137,7 +137,7 @@ def set_donation_url(actor_json: {}, donate_url: str) -> None:
continue
if name_value.lower() != donate_name:
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = donate_value
return

View File

@ -27,7 +27,7 @@ def get_enigma_pub_key(actor_json: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
return property_value['value']
return ''
@ -76,7 +76,7 @@ def set_enigma_pub_key(actor_json: {}, enigma_pub_key: str) -> None:
continue
if not name_value.lower().startswith('enigma'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = enigma_pub_key
return

View File

@ -27,7 +27,7 @@ def get_matrix_address(actor_json: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
if '@' not in property_value['value']:
continue
@ -91,7 +91,7 @@ def set_matrix_address(actor_json: {}, matrix_address: str) -> None:
continue
if not name_value.lower().startswith('matrix'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = matrix_address
return

12
pgp.py
View File

@ -49,7 +49,7 @@ def get_email_address(actor_json: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
if '@' not in property_value['value']:
continue
@ -78,7 +78,7 @@ def get_pgp_pub_key(actor_json: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
if not contains_pgp_public_key(property_value['value']):
continue
@ -105,7 +105,7 @@ def get_pgp_fingerprint(actor_json: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
if len(property_value['value']) < 10:
continue
@ -162,7 +162,7 @@ def set_email_address(actor_json: {}, email_address: str) -> None:
continue
if not name_value.lower().startswith('email'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = email_address
return
@ -223,7 +223,7 @@ def set_pgp_pub_key(actor_json: {}, pgp_pub_key: str) -> None:
continue
if not name_value.lower().startswith('pgp'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = pgp_pub_key
return
@ -282,7 +282,7 @@ def set_pgp_fingerprint(actor_json: {}, fingerprint: str) -> None:
continue
if not name_value.lower().startswith('openpgp'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = fingerprint.strip()
return

4
ssb.py
View File

@ -27,7 +27,7 @@ def get_ssb_address(actor_json: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = property_value['value'].strip()
if not property_value['value'].startswith('@'):
@ -97,7 +97,7 @@ def set_ssb_address(actor_json: {}, ssb_address: str) -> None:
continue
if not name_value.lower().startswith('ssb'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = ssb_address
return

4
tox.py
View File

@ -27,7 +27,7 @@ def get_tox_address(actor_json: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = property_value['value'].strip()
if len(property_value['value']) != 76:
@ -102,7 +102,7 @@ def set_tox_address(actor_json: {}, tox_address: str) -> None:
continue
if not name_value.lower().startswith('tox'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = tox_address
return

View File

@ -65,7 +65,7 @@ def get_actor_languages_list(actor_json: {}) -> []:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
if isinstance(property_value['value'], list):
lang_list = property_value['value']
@ -3131,7 +3131,7 @@ def get_actor_property_url(actor_json: {}, property_name: str) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = property_value['value'].strip()
prefixes = get_protocol_prefixes()

View File

@ -226,7 +226,7 @@ def _set_actor_property_url(actor_json: {},
continue
if not name_value.lower().startswith(property_name_lower):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = url
return

View File

@ -435,7 +435,7 @@ def _webfinger_updateFromProfile(wf_json: {}, actor_json: {}) -> bool:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
new_value = property_value['value'].strip()

View File

@ -28,7 +28,7 @@ def get_xmpp_address(actor_json: {}) -> str:
continue
if not property_value.get('value'):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
if '@' not in property_value['value']:
continue
@ -90,7 +90,7 @@ def set_xmpp_address(actor_json: {}, xmpp_address: str) -> None:
if not (name_value.startswith('xmpp') or
name_value.startswith('jabber')):
continue
if property_value['type'] != 'PropertyValue':
if not property_value['type'].endswith('PropertyValue'):
continue
property_value['value'] = xmpp_address
return