Work on better way to update objects. A lot of work! Also a lot of clean up.

This commit is contained in:
Scott Idem
2021-06-10 18:31:53 -04:00
parent e45bb2fbcd
commit 19bba3d8a9
6 changed files with 233 additions and 12 deletions

View File

@@ -19,6 +19,7 @@ def load_account_obj(
account_id: int|str,
enabled: str = 'enabled', # enabled, disabled, all
limit: int = 1000,
inc_account_cfg: bool = False,
inc_address: bool = False, # Under contact
inc_address_list: bool = False,
inc_archive: bool = False,
@@ -54,13 +55,27 @@ def load_account_obj(
inc_event_session_list: bool = False,
inc_event_track: bool = False, # For event_session child object
inc_event_track_list: bool = False,
inc_fundraising_cfg: bool = False,
inc_hosted_file_list: bool = False,
inc_journal_list: bool = False,
inc_membership: bool = False,
inc_membership_list: bool = False,
inc_order: bool = False,
inc_order_list: bool = False,
inc_order_cart: bool = False,
inc_order_cart_list: bool = False,
inc_organization: bool = False,
inc_organization_list: bool = False,
inc_person: bool = False,
inc_user: bool = False
inc_person_list: bool = False,
inc_post: bool = False,
inc_post_list: bool = False,
inc_product: bool = False,
inc_product_list: bool = False,
inc_site: bool = False,
inc_site_list: bool = False,
inc_user: bool = False,
inc_user_list: bool = False,
) -> Account_Base|bool:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
@@ -68,7 +83,7 @@ def load_account_obj(
if account_id := redis_lookup_id_random(record_id_random=account_id, table_name='account'): pass
else: return False
if account_rec := sql_select(table_name='v_account', record_id=account_id): pass
if account_rec := sql_select(table_name='account', record_id=account_id): pass
else: return False
#log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
@@ -150,15 +165,16 @@ def load_account_obj(
if event_obj := load_event_obj(
event_id=event_id,
enabled=enabled,
inc_address=inc_address,
inc_contact=inc_contact,
inc_location_address=inc_address,
inc_contact_1=inc_contact,
inc_contact_2=inc_contact,
inc_contact_3=inc_contact,
inc_event_abstract_list=inc_event_abstract_list,
inc_event_badge_list=inc_event_badge_list,
inc_event_device_list=inc_event_device_list,
inc_event_exhibit_list=inc_event_exhibit_list,
inc_event_file_list=inc_event_file_list,
inc_event_location_list=inc_event_location_list,
inc_event_person=inc_event_person,
inc_event_person_list=inc_event_person_list,
inc_event_presentation_list=inc_event_presentation_list,
inc_event_presenter_list=inc_event_presenter_list,

View File

@@ -41,6 +41,8 @@ def load_event_obj(
inc_event_track_list: bool = False,
inc_location_address: bool = False,
inc_poc_event_person: bool = False,
inc_person: bool = False,
inc_user: bool = False,
) -> Event_Base|bool:
#log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
@@ -144,6 +146,8 @@ def load_event_obj(
inc_event_presenter_cat=inc_event_presenter_cat,
inc_event_presenter_list=inc_event_presenter_list,
#inc_event_track=inc_event_track,
inc_person=inc_person,
inc_user=inc_user,
):
data = event_session_obj.dict(by_alias=True, exclude_unset=True)
event_session_obj_li.append(data)