Rearrange these continues into relevant condition.

This commit is contained in:
voussoir 2021-01-01 13:23:32 -08:00
parent b1000dd0f8
commit 79327de0f0

View file

@ -320,9 +320,9 @@ def normalize_orderby(orderby, warning_bag=None):
exc = ValueError(constants.WARNING_ORDERBY_INVALID.format(request=requested_order)) exc = ValueError(constants.WARNING_ORDERBY_INVALID.format(request=requested_order))
if warning_bag: if warning_bag:
warning_bag.add(exc) warning_bag.add(exc)
continue
else: else:
raise exc raise exc
continue
if direction not in ('asc', 'desc'): if direction not in ('asc', 'desc'):
message = constants.WARNING_ORDERBY_BADDIRECTION.format( message = constants.WARNING_ORDERBY_BADDIRECTION.format(
@ -332,17 +332,17 @@ def normalize_orderby(orderby, warning_bag=None):
exc = ValueError(message) exc = ValueError(message)
if warning_bag: if warning_bag:
warning_bag.add(exc) warning_bag.add(exc)
direction = 'desc'
else: else:
raise exc raise exc
direction = 'desc'
if column not in constants.ALLOWED_ORDERBY_COLUMNS: if column not in constants.ALLOWED_ORDERBY_COLUMNS:
exc = ValueError(constants.WARNING_ORDERBY_BADCOL.format(column=column)) exc = ValueError(constants.WARNING_ORDERBY_BADCOL.format(column=column))
if warning_bag: if warning_bag:
warning_bag.add(exc) warning_bag.add(exc)
continue
else: else:
raise exc raise exc
continue
if column == 'random': if column == 'random':
column = 'RANDOM()' column = 'RANDOM()'