+ if self.pagename == 'file':
+ if 'reload' in self.postvars.as_dict:
+ self.server.load()
+ elif 'save' in self.postvars.as_dict:
+ self.server.save()
+ elif self.pagename == 'edit':
+ id_ = int(self.path_toks[2])
+ old_booking = self.server.bookings[id_]
+ start_idx = self.server.dat_lines.index(old_booking.dat_lines[0])
+ end_idx = self.server.dat_lines.index(old_booking.dat_lines[-1])
+ new_dat_lines = [DatLine(line) for line
+ in self.postvars.first('booking').splitlines()]
+ self.server.dat_lines = (self.server.dat_lines[:start_idx]
+ + new_dat_lines
+ + self.server.dat_lines[end_idx+1:])
+ self.server.load_bookings()
+ self.server.tainted = True
+ self.redirect(Path('/').joinpath('booking').joinpath(str(id_)))
+ return
+ self.redirect(Path('/'))