Snake case

merge-requests/30/head
Bob Mottram 2021-12-26 15:54:46 +00:00
parent 5254142511
commit a16202afbe
8 changed files with 18 additions and 18 deletions

View File

@ -8,7 +8,7 @@ __status__ = "Production"
__module_group__ = "ActivityPub" __module_group__ = "ActivityPub"
import os import os
from utils import hasObjectStringObject from utils import has_object_string_object
from utils import has_users_path from utils import has_users_path
from utils import get_full_domain from utils import get_full_domain
from utils import urlPermitted from utils import urlPermitted
@ -90,7 +90,7 @@ def _accept_follow(base_dir: str, domain: str, message_json: {},
print('DEBUG: no actor in Follow activity') print('DEBUG: no actor in Follow activity')
return return
# no, this isn't a mistake # no, this isn't a mistake
if not hasObjectStringObject(message_json, debug): if not has_object_string_object(message_json, debug):
return return
if not message_json.get('to'): if not message_json.get('to'):
if debug: if debug:

View File

@ -7,7 +7,7 @@ __email__ = "bob@libreserver.org"
__status__ = "Production" __status__ = "Production"
__module_group__ = "ActivityPub" __module_group__ = "ActivityPub"
from utils import hasObjectStringObject from utils import has_object_string_object
from utils import hasGroupType from utils import hasGroupType
from utils import removeDomainPort from utils import removeDomainPort
from utils import removeIdEnding from utils import removeIdEnding
@ -402,7 +402,7 @@ def outboxUndoAnnounce(recentPostsCache: {},
if debug: if debug:
print('DEBUG: not a undo announce') print('DEBUG: not a undo announce')
return return
if not hasObjectStringObject(message_json, debug): if not has_object_string_object(message_json, debug):
return return
if debug: if debug:
print('DEBUG: c2s undo announce request arrived in outbox') print('DEBUG: c2s undo announce request arrived in outbox')

View File

@ -12,7 +12,7 @@ import json
import time import time
from datetime import datetime from datetime import datetime
from utils import hasObjectString from utils import hasObjectString
from utils import hasObjectStringObject from utils import has_object_string_object
from utils import hasObjectStringType from utils import hasObjectStringType
from utils import removeDomainPort from utils import removeDomainPort
from utils import has_object_dict from utils import has_object_dict
@ -483,7 +483,7 @@ def outboxUndoBlock(base_dir: str, http_prefix: str,
if debug: if debug:
print('DEBUG: not an undo block') print('DEBUG: not an undo block')
return return
if not hasObjectStringObject(message_json, debug): if not has_object_string_object(message_json, debug):
return return
if debug: if debug:
print('DEBUG: c2s undo block request arrived in outbox') print('DEBUG: c2s undo block request arrived in outbox')

View File

@ -9,7 +9,7 @@ __module_group__ = "ActivityPub"
from pprint import pprint from pprint import pprint
import os import os
from utils import hasObjectStringObject from utils import has_object_string_object
from utils import hasObjectStringType from utils import hasObjectStringType
from utils import removeDomainPort from utils import removeDomainPort
from utils import has_users_path from utils import has_users_path
@ -1390,7 +1390,7 @@ def outboxUndoFollow(base_dir: str, message_json: {}, debug: bool) -> None:
if not message_json['object']['type'] == 'Follow': if not message_json['object']['type'] == 'Follow':
if not message_json['object']['type'] == 'Join': if not message_json['object']['type'] == 'Join':
return return
if not hasObjectStringObject(message_json, debug): if not has_object_string_object(message_json, debug):
return return
if not message_json['object'].get('actor'): if not message_json['object'].get('actor'):
return return

View File

@ -24,7 +24,7 @@ from utils import invalidCiphertext
from utils import removeHtml from utils import removeHtml
from utils import fileLastModified from utils import fileLastModified
from utils import hasObjectString from utils import hasObjectString
from utils import hasObjectStringObject from utils import has_object_string_object
from utils import getReplyIntervalHours from utils import getReplyIntervalHours
from utils import canReplyTo from utils import canReplyTo
from utils import get_user_paths from utils import get_user_paths
@ -813,7 +813,7 @@ def _receiveUndo(session, base_dir: str, http_prefix: str,
return False return False
if not hasObjectStringType(message_json, debug): if not hasObjectStringType(message_json, debug):
return False return False
if not hasObjectStringObject(message_json, debug): if not has_object_string_object(message_json, debug):
return False return False
if message_json['object']['type'] == 'Follow' or \ if message_json['object']['type'] == 'Follow' or \
message_json['object']['type'] == 'Join': message_json['object']['type'] == 'Join':
@ -1141,7 +1141,7 @@ def _receiveUndoLike(recentPostsCache: {},
return False return False
if message_json['object']['type'] != 'Like': if message_json['object']['type'] != 'Like':
return False return False
if not hasObjectStringObject(message_json, debug): if not has_object_string_object(message_json, debug):
return False return False
if not has_users_path(message_json['actor']): if not has_users_path(message_json['actor']):
if debug: if debug:
@ -1402,7 +1402,7 @@ def _receiveUndoReaction(recentPostsCache: {},
return False return False
if message_json['object']['type'] != 'EmojiReact': if message_json['object']['type'] != 'EmojiReact':
return False return False
if not hasObjectStringObject(message_json, debug): if not has_object_string_object(message_json, debug):
return False return False
if not message_json['object'].get('content'): if not message_json['object'].get('content'):
if debug: if debug:
@ -2044,7 +2044,7 @@ def _receiveUndoAnnounce(recentPostsCache: {},
return False return False
if not has_object_dict(message_json): if not has_object_dict(message_json):
return False return False
if not hasObjectStringObject(message_json, debug): if not has_object_string_object(message_json, debug):
return False return False
if message_json['object']['type'] != 'Announce': if message_json['object']['type'] != 'Announce':
return False return False

View File

@ -10,7 +10,7 @@ __module_group__ = "ActivityPub"
import os import os
from pprint import pprint from pprint import pprint
from utils import hasObjectString from utils import hasObjectString
from utils import hasObjectStringObject from utils import has_object_string_object
from utils import hasObjectStringType from utils import hasObjectStringType
from utils import removeDomainPort from utils import removeDomainPort
from utils import has_object_dict from utils import has_object_dict
@ -390,7 +390,7 @@ def outboxUndoLike(recentPostsCache: {},
if debug: if debug:
print('DEBUG: not a undo like') print('DEBUG: not a undo like')
return return
if not hasObjectStringObject(message_json, debug): if not has_object_string_object(message_json, debug):
return return
if debug: if debug:
print('DEBUG: c2s undo like request arrived in outbox') print('DEBUG: c2s undo like request arrived in outbox')

View File

@ -12,7 +12,7 @@ import re
import urllib.parse import urllib.parse
from pprint import pprint from pprint import pprint
from utils import hasObjectString from utils import hasObjectString
from utils import hasObjectStringObject from utils import has_object_string_object
from utils import hasObjectStringType from utils import hasObjectStringType
from utils import removeDomainPort from utils import removeDomainPort
from utils import has_object_dict from utils import has_object_dict
@ -418,7 +418,7 @@ def outboxUndoReaction(recentPostsCache: {},
return return
if not isinstance(message_json['object']['content'], str): if not isinstance(message_json['object']['content'], str):
return return
if not hasObjectStringObject(message_json, debug): if not has_object_string_object(message_json, debug):
return return
if debug: if debug:
print('DEBUG: c2s undo reaction request arrived in outbox') print('DEBUG: c2s undo reaction request arrived in outbox')

View File

@ -3194,7 +3194,7 @@ def hasObjectStringType(post_json_object: {}, debug: bool) -> bool:
return False return False
def hasObjectStringObject(post_json_object: {}, debug: bool) -> bool: def has_object_string_object(post_json_object: {}, debug: bool) -> bool:
"""Does the given post have an object string field within an object dict? """Does the given post have an object string field within an object dict?
""" """
if not has_object_dict(post_json_object): if not has_object_dict(post_json_object):