Updates to presenter for new fields with JSON
This commit is contained in:
@@ -31,8 +31,9 @@ def get_token_header(x_token: str = Header(...)):
|
||||
class Common_Route_Params_No_Account_ID:
|
||||
def __init__(
|
||||
self,
|
||||
x_account_id: int = None,
|
||||
x_account_id_random: str = None,
|
||||
x_account_id: int|None = None,
|
||||
x_account_id_random: str|None = None,
|
||||
x_no_account_id_token: str|None = None,
|
||||
enabled: str = 'enabled',
|
||||
limit: int = 10,
|
||||
offset: int = 0,
|
||||
@@ -42,6 +43,7 @@ class Common_Route_Params_No_Account_ID:
|
||||
):
|
||||
self.x_account_id = x_account_id
|
||||
self.x_account_id_random = x_account_id_random
|
||||
self.x_no_account_id_token = x_no_account_id_token
|
||||
self.enabled = enabled
|
||||
self.limit = limit
|
||||
self.offset = offset
|
||||
@@ -143,7 +145,7 @@ def common_route_params(
|
||||
# include: Optional[list] = [], # Leaving this and exclude commented out
|
||||
response: Response = Response,
|
||||
log_lvl: int = logging.INFO, # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
) -> Common_Route_Params:
|
||||
) -> Common_Route_Params|Common_Route_Params_No_Account_ID:
|
||||
log.setLevel(log_lvl)
|
||||
log.debug(locals())
|
||||
|
||||
@@ -160,7 +162,7 @@ def common_route_params(
|
||||
elif x_no_account_id and len(x_no_account_id) > 10:
|
||||
log.warning(f'Found the x_no_account_id header param with the value: {x_no_account_id}')
|
||||
|
||||
x_account_id = 0
|
||||
x_account_id = None
|
||||
x_account_id_random = '--- NOT SET ---'
|
||||
|
||||
elif x_no_account_id_token and len(x_no_account_id_token) > 10: # NOTE: Not a header value!
|
||||
@@ -180,7 +182,10 @@ def common_route_params(
|
||||
log.warning(f'The x-account-id and x-no-account-id-token headers were not found.')
|
||||
raise HTTPException(status_code=403, detail='The x-account-id and x-no-account-id-token headers were not found.') # Forbidden
|
||||
|
||||
commons = Common_Route_Params( x_account_id=x_account_id, x_account_id_random=x_account_id_random, x_no_account_id_token=x_no_account_id_token, limit=limit, offset=offset, enabled=enabled, by_alias=by_alias, exclude_unset=exclude_unset, response=response )
|
||||
if x_account_id:
|
||||
commons = Common_Route_Params( x_account_id=x_account_id, x_account_id_random=x_account_id_random, x_no_account_id_token=x_no_account_id_token, limit=limit, offset=offset, enabled=enabled, by_alias=by_alias, exclude_unset=exclude_unset, response=response )
|
||||
else:
|
||||
commons = Common_Route_Params_No_Account_ID( x_account_id=None, x_account_id_random=None, x_no_account_id_token=x_no_account_id_token, limit=limit, offset=offset, enabled=enabled, by_alias=by_alias, exclude_unset=exclude_unset, response=response )
|
||||
|
||||
log.debug(commons)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user