Clean up and testing. Starting to mark things as deprecated.

This commit is contained in:
Scott Idem
2021-12-08 12:27:29 -05:00
parent 39eb3baebd
commit 7aa2ecc4af
11 changed files with 57 additions and 180 deletions

View File

@@ -249,22 +249,22 @@ def load_user_obj(
model_as_dict: bool = False,
enabled: str = 'enabled', # enabled, disabled, all
inc_address: bool = False,
# inc_archive_list: bool = False,
# inc_archive_list: bool = False, # deprecated
inc_contact: bool = False,
inc_event_list: bool = False,
# inc_hosted_file_list: bool = False,
inc_journal_list: bool = False,
inc_journal_entry_list: bool = False,
inc_membership_person: bool = False,
inc_order_cfg: bool = False,
inc_order_line_list: bool = False,
inc_order_list: bool = False,
inc_order_cart_list: bool = False,
inc_organization: bool = False,
inc_event_list: bool = False, # deprecated
# inc_hosted_file_list: bool = False, # deprecated
# inc_journal_list: bool = False, # deprecated
# inc_journal_entry_list: bool = False, # deprecated
# inc_membership_person: bool = False, # deprecated
inc_order_cfg: bool = False, # deprecated
inc_order_line_list: bool = False, # deprecated
inc_order_list: bool = False, # deprecated
inc_order_cart_list: bool = False, # deprecated
inc_organization: bool = False, # deprecated
inc_person: bool = False,
# inc_person_list: bool = False,
inc_post_list: bool = False,
inc_post_comment_list: bool = False,
# inc_person_list: bool = False, # deprecated
# inc_post_list: bool = False, # deprecated
# inc_post_comment_list: bool = False, # deprecated
inc_user_role_list: bool = False,
) -> User_Out_Base|dict|bool:
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
@@ -286,7 +286,8 @@ def load_user_obj(
return False
# Updated 2021-06-18
# if inc_contact:
if inc_contact:
log.warning(f'This is being deprecated? load_user_obj() inc_contact')
# contact_id = user_rec.get('contact_id', None)
# log.debug(contact_id)
# if contact_result := load_contact_obj(
@@ -302,6 +303,7 @@ def load_user_obj(
# else: user_obj.contact = None
if inc_event_list:
log.warning(f'This is being deprecated? load_user_obj() inc_event_list')
from app.methods.event_methods import load_event_obj_list
if event_dict_list := load_event_obj_list(
user_id = user_id,
@@ -314,6 +316,7 @@ def load_user_obj(
# Updated 2021-06-18
if inc_order_list:
log.warning(f'This is being deprecated? load_user_obj() inc_order_list')
if order_rec_list_result := get_order_rec_list(
for_obj_type = 'user',
for_obj_id = user_id,
@@ -340,6 +343,7 @@ def load_user_obj(
# Updated 2021-06-18
if inc_organization:
log.warning(f'This is being deprecated? load_user_obj() inc_organization')
organization_id = user_rec.get('organization_id', None)
log.debug(organization_id)
if organization_result := load_organization_obj(
@@ -373,30 +377,31 @@ def load_user_obj(
log.debug(person_result)
# Updated 2021-06-18
if inc_post_list:
if post_rec_list_result := get_post_rec_list(
for_obj_type = 'user',
for_obj_id = user_id,
limit = limit,
enabled = enabled,
):
post_result_list = []
for post_rec in post_rec_list_result:
if load_post_result := load_post_obj(
post_id = post_rec.get('post_id', None),
limit = limit,
by_alias = by_alias,
exclude_unset = exclude_unset,
model_as_dict = model_as_dict,
enabled = enabled,
inc_post_comment_list = inc_post_comment_list,
inc_person = inc_person,
# inc_user = inc_user,
):
post_result_list.append(load_post_result)
else: post_result_list.append(None)
user_obj.post_list = post_result_list
else: user_obj.post_list = []
# if inc_post_list:
# log.warning(f'This is being deprecated? load_user_obj() inc_post_list')
# if post_rec_list_result := get_post_rec_list(
# for_obj_type = 'user',
# for_obj_id = user_id,
# limit = limit,
# enabled = enabled,
# ):
# post_result_list = []
# for post_rec in post_rec_list_result:
# if load_post_result := load_post_obj(
# post_id = post_rec.get('post_id', None),
# limit = limit,
# by_alias = by_alias,
# exclude_unset = exclude_unset,
# model_as_dict = model_as_dict,
# enabled = enabled,
# inc_post_comment_list = inc_post_comment_list,
# inc_person = inc_person,
# # inc_user = inc_user,
# ):
# post_result_list.append(load_post_result)
# else: post_result_list.append(None)
# user_obj.post_list = post_result_list
# else: user_obj.post_list = []
# Updated 2021-06-25
if inc_user_role_list: