WillemVH commited on
Commit
e832d85
·
verified ·
1 Parent(s): 5db2c1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -27,8 +27,7 @@ def update_servo_in_database(fileid, new_value):
27
  file.writelines(lines)
28
  return True
29
  except Exception as e:
30
- print(f"database was not really updated 😟: {e}")
31
- return False
32
  @app.route('/')
33
  def main():
34
  files = os.listdir('.')
@@ -85,7 +84,7 @@ def debuggly():
85
  # make sure it's between 1 and 180
86
  new_value = int(new_value)
87
  if new_value < 0 or new_value > 180:
88
- return "Error: Servo value must be between 0-180 degrees", 400
89
 
90
  # update the servo
91
  servos[servo_num - 1] = str(new_value) # do the minus thing because list starts a 0 not 1 :(
@@ -94,9 +93,9 @@ def debuggly():
94
  updated_line = ','.join(servos)
95
  if update_servo_in_database(id, updated_line):
96
  if servolist is None:
97
- return f"created new line {id} with no problems ever! servo {servo_num} set to {new_value}°<br>New values: {updated_line}"
98
  else:
99
- return f"updated line {id}! servo {servo_num} set to {new_value}°<br>new values: {updated_line}"
100
  else:
101
  return "yeah nah that didn't work :(", 500
102
 
 
27
  file.writelines(lines)
28
  return True
29
  except Exception as e:
30
+ return(f"database was not really updated 😟: {e}")
 
31
  @app.route('/')
32
  def main():
33
  files = os.listdir('.')
 
84
  # make sure it's between 1 and 180
85
  new_value = int(new_value)
86
  if new_value < 0 or new_value > 180:
87
+ return "please try to keep the value between 1 to 180", 400
88
 
89
  # update the servo
90
  servos[servo_num - 1] = str(new_value) # do the minus thing because list starts a 0 not 1 :(
 
93
  updated_line = ','.join(servos)
94
  if update_servo_in_database(id, updated_line):
95
  if servolist is None:
96
+ return f"created new line {id} with no problems ever! servo {servo_num} set to {new_value}° as well :D"
97
  else:
98
+ return f"updated line {id} with no problems ever! servo {servo_num} set to {new_value}° as well :D"
99
  else:
100
  return "yeah nah that didn't work :(", 500
101