Changeset 626 in tmcsimulator for branches/LCSv2/controllers/default.py
- Timestamp:
- 08/30/2020 01:49:28 PM (6 years ago)
- File:
-
- 1 edited
-
branches/LCSv2/controllers/default.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/LCSv2/controllers/default.py
r624 r626 299 299 return dict(form=form) 300 300 301 # An unlinked page to allow admin to reset the database to simulation start state 302 def resetdb(): 303 form = FORM("Press this button to reset the closure database to its original state at the start of a simulation.",BR(), 304 "Warning: this will delete all the current closures.",BR(), 305 "Import filename is 'db_closures_start.csv'.",BR(), 306 INPUT(_value="Reset Database", _type='submit', _class="btn btn-primary btn-default")) 307 if form.process().accepted: 308 db(db.closures.id > 0).delete() # remove all current records 309 with open('db_closures_start.csv', 'rb') as dumpfile: 310 db.closures.import_from_csv_file(dumpfile) # import from starting state 311 session.flash = 'Closure database has been reset' 312 redirect(URL('search.html')) 313 return dict(form=form) 314 301 315 # Validation for existing closure button 302 316 # If user selected Yes (it's existing incident) then they must select a closure ID … … 347 361 result = result + "#"+item + " " 348 362 result = result + "of " + lanecount 349 return result 363 return result
Note: See TracChangeset
for help on using the changeset viewer.
