recipe links
This commit is contained in:
+3
-2
@@ -751,8 +751,9 @@ def _inventory_validation(field, reason):
|
||||
|
||||
def _inventory_batch_input(request, data, *, deleting=False):
|
||||
rows = data.get('item_ids' if deleting else 'items')
|
||||
if not isinstance(rows, list) or not 1 <= len(rows) <= 20:
|
||||
raise ValueError('Provide between 1 and 20 inventory items.')
|
||||
limit = 20 if deleting else 50
|
||||
if not isinstance(rows, list) or not 1 <= len(rows) <= limit:
|
||||
raise ValueError(f'Provide between 1 and {limit} inventory items.')
|
||||
if set(data) - ({'item_ids', 'dry_run', 'atomic', 'confirm'} if deleting else {'items', 'dry_run', 'atomic'}):
|
||||
raise ValueError('Unknown bulk inventory fields.')
|
||||
if any(type(data.get(key, default)) is not bool for key, default in (('dry_run', False), ('atomic', False))):
|
||||
|
||||
Reference in New Issue
Block a user