#65: Starting auto casting in app sdk. Might break some things.

This commit is contained in:
frikky
2020-06-17 20:03:47 +02:00
parent 89ae46925e
commit 96b5998ce0
9 changed files with 8172 additions and 11845 deletions
+17 -1
View File
@@ -442,7 +442,8 @@ class AppBase:
for parameter in action["parameters"]:
check, value = parse_params(action, fullexecution, parameter)
if check:
raise Exception(check)
raise "Value check error: %s" % Exception(check)
# Custom format for ${name[0,1,2,...]}$
submatch = "([${]{2}([0-9a-zA-Z_-]+)(\[.*\])[}$]{2})"
@@ -483,6 +484,21 @@ class AppBase:
# With this parameter ready, add it to... a greater list of parameters. Rofl
multi_parameters[parameter["name"]] = resultarray
else:
# Testing casting
if value.lower() == "true":
value = True
elif value.lower() == "false":
value = False
else:
constructors = [int]
for c in constructors:
try:
value = c(value)
print("Successfully parsed %s to %s", value, c)
except ValueError:
print("Failed to parse %s to %s", value, c)
pass
params[parameter["name"]] = value
multi_parameters[parameter["name"]] = value