Bug fix for special characters in GET params because of % symbol
This commit is contained in:
@@ -80,8 +80,6 @@ async def lookup_site_domain_obj(
|
||||
referrer: Optional[str] = None,
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: bool = True,
|
||||
#include: Optional[list] = [],
|
||||
#exclude: Optional[list] = [],
|
||||
exclude_unset: bool = True,
|
||||
exclude_none: bool = True,
|
||||
response: Response = Response,
|
||||
@@ -115,6 +113,7 @@ async def lookup_site_domain_obj(
|
||||
"""
|
||||
log.debug(sql)
|
||||
|
||||
# NOTE: This need to broken out into a methods function for site and or site_domain
|
||||
if site_domain_obj_result := sql_select(data=data, sql=sql):
|
||||
try:
|
||||
site_obj = Site_Base(**site_domain_obj_result).dict(by_alias=by_alias, exclude_unset=exclude_unset, exclude_none=exclude_none)
|
||||
@@ -159,9 +158,9 @@ async def get_site_domain_obj_li(
|
||||
return result
|
||||
|
||||
|
||||
@router.get('/{obj_id}', response_model=Resp_Body_Base)
|
||||
@router.get('/{site_domain_id}', response_model=Resp_Body_Base)
|
||||
async def get_site_domain_obj(
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
site_domain_id: str = Query(..., min_length=11, max_length=22),
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
@@ -171,14 +170,39 @@ async def get_site_domain_obj(
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
obj_type = 'site_domain'
|
||||
result = get_obj_template(
|
||||
obj_type=obj_type,
|
||||
obj_id=obj_id,
|
||||
by_alias=True,
|
||||
exclude_unset=True,
|
||||
)
|
||||
return result
|
||||
if site_domain_id := redis_lookup_id_random(record_id_random=site_domain_id, table_name='site_domain'): pass
|
||||
else: return mk_resp(data=None, status_code=404, response=response)
|
||||
|
||||
data = { 'site_domain_id': site_domain_id }
|
||||
|
||||
sql = f"""
|
||||
SELECT *, site_enable_from AS 'enable_from', site_enable_to AS 'enable_to'
|
||||
FROM `v_site_domain` AS site_domain
|
||||
WHERE site_domain.id = :site_domain_id
|
||||
;
|
||||
"""
|
||||
log.debug(sql)
|
||||
|
||||
# NOTE: This need to broken out into a methods function for site and or site_domain
|
||||
if site_domain_obj_result := sql_select(data=data, sql=sql):
|
||||
try:
|
||||
site_obj = Site_Base(**site_domain_obj_result).dict(by_alias=by_alias, exclude_unset=exclude_unset, exclude_none=exclude_none)
|
||||
log.debug(site_obj)
|
||||
except ValidationError as e:
|
||||
log.error(e.json())
|
||||
try:
|
||||
site_domain_obj = Site_Domain_Base(**site_domain_obj_result).dict(by_alias=by_alias, exclude_unset=exclude_unset, exclude_none=exclude_none)
|
||||
log.debug(site_domain_obj)
|
||||
except ValidationError as e:
|
||||
log.error(e.json())
|
||||
|
||||
site_domain_obj['site'] = site_obj
|
||||
log.debug(site_domain_obj)
|
||||
|
||||
return mk_resp(data=site_domain_obj)
|
||||
else:
|
||||
log.debug(site_domain_obj_result)
|
||||
return mk_resp(data=False, status_code=404, response=response)
|
||||
|
||||
|
||||
@router.delete('/{obj_id}', response_model=Resp_Body_Base)
|
||||
|
||||
Reference in New Issue
Block a user