Debugging...
This commit is contained in:
@@ -29,7 +29,7 @@ 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
|
||||
log_lvl: int = logging.INFO, # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
) -> int|bool:
|
||||
log.setLevel(log_lvl)
|
||||
|
||||
@@ -149,7 +149,7 @@ def update_person_kiss(
|
||||
organization_id: int|None = None,
|
||||
user_id: int|None = None,
|
||||
set_default_password: bool = True,
|
||||
log_lvl: int = logging.DEBUG, # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log_lvl: int = logging.INFO, # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
) -> bool:
|
||||
log.setLevel(log_lvl)
|
||||
|
||||
@@ -204,7 +204,7 @@ def update_person_kiss(
|
||||
|
||||
log.debug(person_dict_up_result)
|
||||
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
# log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
if contact_id and person_obj.contact:
|
||||
log.info('Updating Contact object')
|
||||
if contact_update_result := update_contact_obj(
|
||||
@@ -224,6 +224,7 @@ def update_person_kiss(
|
||||
): pass
|
||||
else: return False
|
||||
else: pass
|
||||
# log.setLevel(log_lvl)
|
||||
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(person_obj.user)
|
||||
@@ -254,6 +255,7 @@ def update_person_kiss(
|
||||
): pass # NOTE: There is a trigger that will update the person record with the new user ID.
|
||||
else: return False
|
||||
else: pass
|
||||
log.setLevel(log_lvl)
|
||||
|
||||
return True
|
||||
# ### END ### API Person Methods ### update_person_kiss() ###
|
||||
|
||||
@@ -47,12 +47,12 @@ def create_user_obj(
|
||||
else: return False
|
||||
|
||||
log.info('Create dictionary or Pydantic object')
|
||||
log.debug(type(user_dict_obj))
|
||||
# log.debug(type(user_dict_obj))
|
||||
if isinstance(user_dict_obj, dict):
|
||||
user_dict = user_dict_obj
|
||||
try:
|
||||
user_obj = User_New_Base(**user_dict)
|
||||
log.debug(user_obj)
|
||||
|
||||
except ValidationError as e:
|
||||
log.error(e.json())
|
||||
return False
|
||||
@@ -61,6 +61,8 @@ def create_user_obj(
|
||||
user_obj.account_id = account_id
|
||||
|
||||
user_dict = user_obj.dict(by_alias=False, exclude_defaults=False, exclude_unset=True, exclude={'contact', 'contact_id_random', 'new_password', 'organization', 'person', 'person_id_random', 'created_on', 'updated_on'})
|
||||
log.debug(user_obj)
|
||||
log.debug(user_dict)
|
||||
|
||||
# ### SECTION ### Process data
|
||||
# Look for an account_id in the user_obj
|
||||
@@ -71,19 +73,19 @@ def create_user_obj(
|
||||
user_dict['account_id'] = account_id
|
||||
|
||||
if user_obj.new_password:
|
||||
log.warning('A new password was passed.')
|
||||
log.info('A new password was passed.')
|
||||
log.debug(user_obj.new_password)
|
||||
elif set_default_password:
|
||||
log.warning('A new password was not passed. Setting a default password.')
|
||||
user_obj.new_password = secrets.token_urlsafe(default_num_bytes)
|
||||
log.debug(user_obj.new_password)
|
||||
|
||||
hash_string = secure_hash_string(string=user_obj.new_password)
|
||||
user_obj.password = hash_string
|
||||
user_dict['password'] = hash_string
|
||||
else:
|
||||
log.warning('A new password was not passed and not setting a default password.')
|
||||
|
||||
log.debug(user_obj.new_password)
|
||||
|
||||
# user_dict['password'] = user_obj.password # There has to be a better way to do this??? It thinks "password" is unset and so is excluded?
|
||||
|
||||
# Look for a person_id in the user_obj
|
||||
|
||||
Reference in New Issue
Block a user