General code clean up
This commit is contained in:
@@ -14,7 +14,7 @@ from app.models.common_field_schema import default_num_bytes
|
||||
# ### BEGIN ### API Address Methods ### load_address_obj() ###
|
||||
@logger_reset
|
||||
def load_address_obj(
|
||||
address_id:int|str,
|
||||
address_id: int|str,
|
||||
enabled: str = 'enabled', # enabled, disabled, all # Probably not needed for the address
|
||||
limit: int = 100, # Probably not needed for the address
|
||||
offset: int = 0,
|
||||
|
||||
@@ -100,13 +100,13 @@ async def get_file_object_hash(file_object:File):
|
||||
|
||||
|
||||
# ### BEGIN ### API Hosted File Route ### guess_file_extension() ###
|
||||
def guess_file_extension(filename:str):
|
||||
def guess_file_extension(filename: str):
|
||||
return filename.rsplit('.', 1)[1].lower()
|
||||
# ### END ### API Hosted File Route ### guess_file_extension() ###
|
||||
|
||||
|
||||
# ### BEGIN ### API Hosted File Route ### allowed_file_extension() ###
|
||||
def allowed_file_extension(extension:str, extension_list:list):
|
||||
def allowed_file_extension(extension: str, extension_list: list):
|
||||
return extension.lower() in extension_list # app.config['ALLOWED_EXTENSIONS']
|
||||
# ### END ### API Hosted File Route ### allowed_file_extension() ###
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ from app.models.membership_person_models import Membership_Person_Base
|
||||
# ### BEGIN ### API Membership Person Methods ### load_membership_person_obj() ###
|
||||
# Updated 2022-01-11
|
||||
def load_membership_person_obj(
|
||||
membership_person_id:int|str,
|
||||
membership_person_id: int|str,
|
||||
limit: int = 100,
|
||||
by_alias: bool = True,
|
||||
exclude_unset: bool = True,
|
||||
|
||||
@@ -16,7 +16,7 @@ from app.models.membership_type_models import Membership_Type_Base
|
||||
|
||||
# ### BEGIN ### API Membership Type Methods ### load_membership_type_obj() ###
|
||||
def load_membership_type_obj(
|
||||
membership_type_id:int|str,
|
||||
membership_type_id: int|str,
|
||||
limit: int = 1000,
|
||||
by_alias: bool = True,
|
||||
exclude_unset: bool = True,
|
||||
|
||||
@@ -43,8 +43,8 @@ def update_order_cart_obj(
|
||||
log.info('Loop through lines to update and calculate totals')
|
||||
|
||||
# Calculate totals
|
||||
order_cart_total_amount:int = 0
|
||||
order_cart_total_quantity:int = 0
|
||||
order_cart_total_amount: int = 0
|
||||
order_cart_total_quantity: int = 0
|
||||
for order_cart_line_obj in order_cart_obj.order_cart_line_list:
|
||||
log.debug(order_cart_line_obj)
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ def get_order_id_cart_for_person_id_v3(
|
||||
|
||||
# ### BEGIN ### API Order Methods ### save_order_obj() ###
|
||||
# @logger_reset
|
||||
def save_order_obj(order_obj_new:Order_Base, repl_order_line_li:bool=False):
|
||||
def save_order_obj(order_obj_new:Order_Base, repl_order_line_li: bool=False):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
@@ -466,8 +466,8 @@ def save_order_obj(order_obj_new:Order_Base, repl_order_line_li:bool=False):
|
||||
|
||||
# Final loop through to get the new order totals
|
||||
# Calculate totals
|
||||
order_total_amount:int = 0
|
||||
order_total_quantity:int = 0
|
||||
order_total_amount: int = 0
|
||||
order_total_quantity: int = 0
|
||||
for order_line_obj_new in order_obj_new.order_line_li:
|
||||
order_total_amount += order_line_obj_new.quantity * order_line_obj_new.amount
|
||||
order_total_quantity += order_line_obj_new.quantity
|
||||
|
||||
@@ -16,14 +16,14 @@ from app.models.organization_models import Organization_Base
|
||||
# ### BEGIN ### API Organization Methods ### load_organization_obj() ###
|
||||
# NOTE: This needs to be updated to the newer method template. Like address, contact, or person -STI 2021-06-10
|
||||
def load_organization_obj(
|
||||
organization_id:int|str,
|
||||
organization_id: int|str,
|
||||
limit: int = 1000,
|
||||
by_alias: bool = True,
|
||||
exclude_unset: bool = True,
|
||||
model_as_dict: bool = False,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
inc_contact:bool=False,
|
||||
inc_address:bool=False
|
||||
inc_contact: bool=False,
|
||||
inc_address: bool=False
|
||||
) -> Organization_Base|bool:
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
Reference in New Issue
Block a user