mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(instances): a clone size of a digit that is no number gets the form's refusal
clone_data checked the clone's vCPUs and memory with str.isdigit(), which takes characters such as a superscript two that int() refuses: the user saw Python's "invalid literal for int()" instead of the refusal. It now checks with str.isdecimal(), whose characters int() reads.
This commit is contained in:
parent
337063bf7b
commit
02ab78fe94
2 changed files with 9 additions and 1 deletions
|
|
@ -137,7 +137,7 @@ def clone_data(user, instance, fields):
|
|||
("memory", instance.config_memory,
|
||||
_("Enter a whole number of memory (MiB) for the clone"))):
|
||||
value = fields.get(f"clone-{key}") or str(source)
|
||||
if not value.isdigit() or int(value) < 1:
|
||||
if not value.isdecimal() or int(value) < 1:
|
||||
raise util.OperationError(refusal)
|
||||
# None: as the VM, nothing to change after the copy
|
||||
data[key] = int(value) if int(value) != source else None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue