mirror of
https://github.com/YunoHost/apps.git
synced 2024-09-03 20:06:07 +02:00
[enh] change_level.py uses int not and have sanity checks for that
This commit is contained in:
parent
95e7426152
commit
b52094a01f
1 changed files with 9 additions and 1 deletions
|
@ -22,6 +22,14 @@ if __name__ == '__main__':
|
|||
print "Error: app '%s' is not present in %s" % (app_id, app_list_name)
|
||||
sys.exit(1)
|
||||
|
||||
app_list[app_id]["level"] = level
|
||||
if not level.isdigit():
|
||||
print "Error: app level must be a number, it's '%s'" % level
|
||||
sys.exit(1)
|
||||
|
||||
if not 0 <= int(level) <= 10:
|
||||
print "Error: app level must be between 0 and 10, it's '%s'" % level
|
||||
sys.exit(1)
|
||||
|
||||
app_list[app_id]["level"] = int(level)
|
||||
|
||||
open(app_list_name, "w").write("\n".join(json.dumps(app_list, indent=4, sort_keys=True).split(" \n")) + "\n")
|
||||
|
|
Loading…
Add table
Reference in a new issue