Snake case

merge-requests/30/head
Bob Mottram 2021-12-28 16:50:20 +00:00
parent 6fdde8e107
commit c6cc551605
4 changed files with 251 additions and 246 deletions

View File

@ -66,7 +66,7 @@ from person import activateAccount
from person import deactivateAccount
from person import registerAccount
from person import personLookup
from person import personBoxJson
from person import person_box_json
from person import createSharedInbox
from person import createNewsInbox
from person import suspendAccount
@ -10170,7 +10170,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxFeed = \
personBoxJson(recent_posts_cache,
person_box_json(recent_posts_cache,
session,
base_dir,
domain,
@ -10202,7 +10202,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxFeed = \
personBoxJson(recent_posts_cache,
person_box_json(recent_posts_cache,
session,
base_dir,
domain,
@ -10329,7 +10329,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxDMFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -10355,7 +10355,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxDMFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -10474,7 +10474,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxRepliesFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -10501,7 +10501,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxRepliesFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -10619,7 +10619,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxMediaFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -10646,7 +10646,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxMediaFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -10761,7 +10761,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxBlogsFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -10788,7 +10788,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
inboxBlogsFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -10904,7 +10904,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxNewsFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -10930,9 +10930,11 @@ class PubServer(BaseHTTPRequestHandler):
else:
pageNumber = 1
if 'page=' not in path:
newswire_votes_threshold = \
self.server.newswire_votes_threshold
# if no page was specified then show the first
inboxNewsFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -10941,7 +10943,7 @@ class PubServer(BaseHTTPRequestHandler):
http_prefix,
max_posts_in_blogs_feed, 'tlnews',
True,
self.server.newswire_votes_threshold,
newswire_votes_threshold,
self.server.positive_voting,
self.server.voting_time_mins)
currNickname = path.split('/users/')[1]
@ -11055,7 +11057,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
inboxFeaturesFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -11081,9 +11083,11 @@ class PubServer(BaseHTTPRequestHandler):
else:
pageNumber = 1
if 'page=' not in path:
newswire_votes_threshold = \
self.server.newswire_votes_threshold
# if no page was specified then show the first
inboxFeaturesFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -11093,7 +11097,7 @@ class PubServer(BaseHTTPRequestHandler):
max_posts_in_blogs_feed,
'tlfeatures',
True,
self.server.newswire_votes_threshold,
newswire_votes_threshold,
self.server.positive_voting,
self.server.voting_time_mins)
currNickname = path.split('/users/')[1]
@ -11378,7 +11382,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
bookmarksFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -11405,7 +11409,7 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
bookmarksFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -11523,7 +11527,7 @@ class PubServer(BaseHTTPRequestHandler):
"""
# get outbox feed for a person
outboxFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir, domain, port, path,
http_prefix, max_posts_in_feed, 'outbox',
@ -11549,7 +11553,7 @@ class PubServer(BaseHTTPRequestHandler):
# if a page wasn't specified then show the first one
pageStr = '?page=' + str(pageNumber)
outboxFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir, domain, port,
path + pageStr,
@ -11651,7 +11655,7 @@ class PubServer(BaseHTTPRequestHandler):
if '/users/' in path:
if authorized:
moderationFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
@ -11677,14 +11681,15 @@ class PubServer(BaseHTTPRequestHandler):
if 'page=' not in path:
# if no page was specified then show the first
moderationFeed = \
personBoxJson(self.server.recent_posts_cache,
person_box_json(self.server.recent_posts_cache,
self.server.session,
base_dir,
domain,
port,
path + '?page=1',
http_prefix,
max_posts_in_feed, 'moderation',
max_posts_in_feed,
'moderation',
True,
0, self.server.positive_voting,
self.server.voting_time_mins)

View File

@ -898,7 +898,7 @@ def personLookup(domain: str, path: str, base_dir: str) -> {}:
return personJson
def personBoxJson(recent_posts_cache: {},
def person_box_json(recent_posts_cache: {},
session, base_dir: str, domain: str, port: int, path: str,
http_prefix: str, noOfItems: int, boxname: str,
authorized: bool,
@ -912,7 +912,7 @@ def personBoxJson(recent_posts_cache: {},
boxname != 'tlfeatures' and \
boxname != 'outbox' and boxname != 'moderation' and \
boxname != 'tlbookmarks' and boxname != 'bookmarks':
print('ERROR: personBoxJson invalid box name ' + boxname)
print('ERROR: person_box_json invalid box name ' + boxname)
return None
if not '/' + boxname in path:
@ -931,7 +931,7 @@ def personBoxJson(recent_posts_cache: {},
try:
pageNumber = int(pageNumber)
except BaseException:
print('EX: personBoxJson unable to convert to int ' +
print('EX: person_box_json unable to convert to int ' +
str(pageNumber))
pass
path = path.split('?page=')[0]

View File

@ -11,7 +11,7 @@ import os
from utils import is_system_account
from utils import get_domain_from_actor
from utils import get_config_param
from person import personBoxJson
from person import person_box_json
from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlFooter
from webapp_utils import getBannerFile
@ -53,7 +53,7 @@ def _htmlFrontScreenPosts(recent_posts_cache: {}, max_recent_posts: int,
'/users/' + nickname + '/' + boxName + \
'?page=' + str(currPage)
outboxFeed = \
personBoxJson({}, session, base_dir, domain, port,
person_box_json({}, session, base_dir, domain, port,
outboxFeedPathStr,
http_prefix, 10, boxName,
authorized, 0, False, 0)

View File

@ -32,7 +32,7 @@ from utils import get_reply_interval_hours
from languages import getActorLanguages
from skills import getSkills
from theme import getThemesList
from person import personBoxJson
from person import person_box_json
from person import getActorJson
from person import getPersonAvatarUrl
from posts import getPersonBox
@ -1055,7 +1055,7 @@ def _htmlProfilePosts(recent_posts_cache: {}, max_recent_posts: int,
'/users/' + nickname + '/' + boxName + '?page=' + \
str(currPage)
outboxFeed = \
personBoxJson({}, session, base_dir, domain,
person_box_json({}, session, base_dir, domain,
port,
outboxFeedPathStr,
http_prefix,