General code clean up. Work on event tracking related

This commit is contained in:
Scott Idem
2022-02-15 13:25:19 -05:00
parent b3cbfcfb9d
commit 003ffb4adf
8 changed files with 155 additions and 23 deletions

View File

@@ -29,9 +29,9 @@ def create_person_kiss(
contact_id: int|None = None,
organization_id: int|None = None,
user_id: int|None = None,
log_lvl: int = logging.WARNING, # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
) -> int|bool:
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
log.setLevel(log_lvl)
# ### SECTION ### Secondary data validation
log.info('Create dictionary or Pydantic object')
@@ -47,7 +47,6 @@ def create_person_kiss(
else:
person_obj = person_dict_obj
person_obj.account_id = account_id
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(person_obj)
person_dict = person_obj.dict(by_alias=False, exclude_defaults=False, exclude_unset=True, exclude={'contact', 'contact_id', 'contact_id_random', 'email', 'cc_email', 'membership_person_id', 'membership_person_id_random', 'organization', 'user', 'created_on', 'updated_on'})
@@ -59,7 +58,6 @@ def create_person_kiss(
# person_obj.account_id = account_id # Is this needed?
# Look for a contact_id in the contact_obj
if contact_id: pass
elif contact_id := person_obj.contact.id: pass
@@ -133,7 +131,7 @@ def create_person_kiss(
else: return False
else: pass
log.info(f'Returning the Person ID: {person_id}')
log.info(f'Returning the new Person ID: {person_id}')
return person_id
# ### END ### API Person Methods ### create_person_kiss() ###
@@ -149,9 +147,9 @@ def update_person_kiss(
contact_id: int|None = None,
organization_id: int|None = None,
user_id: int|None = None,
):
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
log_lvl: int = logging.WARNING, # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
) -> bool:
log.setLevel(log_lvl)
# ### SECTION ### Secondary data validation
log.info('Create dictionary or Pydantic object')