mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
72df995204
commit
f0b9757bde
2
blog.py
2
blog.py
|
@ -272,7 +272,7 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
|
|||
|
||||
person_url = local_actor_url(http_prefix, nickname, domain_full)
|
||||
actor_json = \
|
||||
get_person_from_cache(base_dir, person_url, person_cache, False)
|
||||
get_person_from_cache(base_dir, person_url, person_cache)
|
||||
languages_understood = []
|
||||
if actor_json:
|
||||
languages_understood = get_actor_languages_list(actor_json)
|
||||
|
|
|
@ -34,7 +34,6 @@ from session import post_json
|
|||
|
||||
def undo_bookmarks_collection_entry(recent_posts_cache: {},
|
||||
base_dir: str, post_filename: str,
|
||||
object_url: str,
|
||||
actor: str, domain: str,
|
||||
debug: bool) -> None:
|
||||
"""Undoes a bookmark for a particular actor
|
||||
|
@ -366,7 +365,7 @@ def undo_bookmark_post(recent_posts_cache: {},
|
|||
return None
|
||||
|
||||
undo_bookmarks_collection_entry(recent_posts_cache,
|
||||
base_dir, post_filename, object_url,
|
||||
base_dir, post_filename,
|
||||
new_undo_bookmark_json['actor'],
|
||||
domain, debug)
|
||||
else:
|
||||
|
|
6
cache.py
6
cache.py
|
@ -77,8 +77,8 @@ def store_person_in_cache(base_dir: str, person_url: str,
|
|||
save_json(person_json, cache_filename)
|
||||
|
||||
|
||||
def get_person_from_cache(base_dir: str, person_url: str, person_cache: {},
|
||||
allow_write_to_file: bool) -> {}:
|
||||
def get_person_from_cache(base_dir: str, person_url: str,
|
||||
person_cache: {}) -> {}:
|
||||
"""Get an actor from the cache
|
||||
"""
|
||||
# if the actor is not in memory then try to load it from file
|
||||
|
@ -157,7 +157,7 @@ def get_person_pub_key(base_dir: str, session, person_url: str,
|
|||
person_url.replace(possible_users_path + 'inbox', '/inbox')
|
||||
break
|
||||
person_json = \
|
||||
get_person_from_cache(base_dir, person_url, person_cache, True)
|
||||
get_person_from_cache(base_dir, person_url, person_cache)
|
||||
if not person_json:
|
||||
if debug:
|
||||
print('DEBUG: Obtaining public key for ' + person_url)
|
||||
|
|
|
@ -7935,8 +7935,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
actor_json = \
|
||||
get_person_from_cache(base_dir,
|
||||
options_actor,
|
||||
self.server.person_cache,
|
||||
True)
|
||||
self.server.person_cache)
|
||||
if actor_json:
|
||||
if actor_json.get('movedTo'):
|
||||
moved_to = actor_json['movedTo']
|
||||
|
|
1
inbox.py
1
inbox.py
|
@ -2058,7 +2058,6 @@ def _receive_undo_bookmark(recent_posts_cache: {},
|
|||
|
||||
undo_bookmarks_collection_entry(recent_posts_cache, base_dir,
|
||||
post_filename,
|
||||
message_json['object']['url'],
|
||||
message_json['actor'], domain, debug)
|
||||
# regenerate the html
|
||||
bookmarked_post_json = load_json(post_filename, 0, 1)
|
||||
|
|
|
@ -39,7 +39,7 @@ def get_understood_languages(base_dir: str, http_prefix: str,
|
|||
"""
|
||||
person_url = local_actor_url(http_prefix, nickname, domain_full)
|
||||
actor_json = \
|
||||
get_person_from_cache(base_dir, person_url, person_cache, False)
|
||||
get_person_from_cache(base_dir, person_url, person_cache)
|
||||
if not actor_json:
|
||||
print('WARN: unable to load actor to obtain languages ' + person_url)
|
||||
return []
|
||||
|
@ -117,7 +117,7 @@ def understood_post_language(base_dir: str, nickname: str, domain: str,
|
|||
return True
|
||||
person_url = local_actor_url(http_prefix, nickname, domain_full)
|
||||
actor_json = \
|
||||
get_person_from_cache(base_dir, person_url, person_cache, False)
|
||||
get_person_from_cache(base_dir, person_url, person_cache)
|
||||
if not actor_json:
|
||||
print('WARN: unable to load actor to check languages ' + person_url)
|
||||
return False
|
||||
|
|
|
@ -1686,8 +1686,7 @@ def get_person_avatar_url(base_dir: str, person_url: str, person_cache: {},
|
|||
"""Returns the avatar url for the person
|
||||
"""
|
||||
person_json = \
|
||||
get_person_from_cache(base_dir, person_url, person_cache,
|
||||
allow_downloads)
|
||||
get_person_from_cache(base_dir, person_url, person_cache)
|
||||
if not person_json:
|
||||
return None
|
||||
|
||||
|
|
2
posts.py
2
posts.py
|
@ -313,7 +313,7 @@ def _get_person_box_actor(session, base_dir: str, actor: str,
|
|||
"""Returns the actor json for the given actor url
|
||||
"""
|
||||
person_json = \
|
||||
get_person_from_cache(base_dir, actor, person_cache, True)
|
||||
get_person_from_cache(base_dir, actor, person_cache)
|
||||
if person_json:
|
||||
return person_json
|
||||
|
||||
|
|
2
tests.py
2
tests.py
|
@ -679,7 +679,7 @@ def _test_cache():
|
|||
}
|
||||
person_cache = {}
|
||||
store_person_in_cache(None, person_url, person_json, person_cache, True)
|
||||
result = get_person_from_cache(None, person_url, person_cache, True)
|
||||
result = get_person_from_cache(None, person_url, person_cache)
|
||||
assert result['id'] == 123456
|
||||
assert result['test'] == 'This is a test'
|
||||
|
||||
|
|
|
@ -1116,8 +1116,7 @@ def _get_post_title_announce_html(base_dir: str,
|
|||
container_class_icons, container_class)
|
||||
|
||||
announce_domain, _ = get_domain_from_actor(attributed_to)
|
||||
get_person_from_cache(base_dir, attributed_to,
|
||||
person_cache, allow_downloads)
|
||||
get_person_from_cache(base_dir, attributed_to, person_cache)
|
||||
announce_display_name = \
|
||||
get_display_name(base_dir, attributed_to, person_cache)
|
||||
if announce_display_name:
|
||||
|
@ -1325,7 +1324,7 @@ def _get_post_title_reply_html(base_dir: str,
|
|||
return (title_str, reply_avatar_image_in_post,
|
||||
container_class_icons, container_class)
|
||||
|
||||
get_person_from_cache(base_dir, reply_actor, person_cache, allow_downloads)
|
||||
get_person_from_cache(base_dir, reply_actor, person_cache)
|
||||
reply_display_name = \
|
||||
get_display_name(base_dir, reply_actor, person_cache)
|
||||
if reply_display_name:
|
||||
|
@ -2121,7 +2120,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
|||
domain_full = get_full_domain(domain, port)
|
||||
person_url = local_actor_url(http_prefix, nickname, domain_full)
|
||||
actor_json = \
|
||||
get_person_from_cache(base_dir, person_url, person_cache, False)
|
||||
get_person_from_cache(base_dir, person_url, person_cache)
|
||||
languages_understood = []
|
||||
if actor_json:
|
||||
languages_understood = get_actor_languages_list(actor_json)
|
||||
|
|
Loading…
Reference in New Issue