# pylint: disable=invalid-name,missing-function-docstring
ctx = {'tainted': self.server.tainted, 'path': self.path}
if self.pagename == 'booking' or self.pagename.startswith('edit_'):
- ctx['id'] = int(self.path_toks[2])
+ id_ = int(self.path_toks[2])
+ if self.pagename.startswith('edit_'):
+ ctx['id'] = id_
if self.pagename == 'balance':
valid, balance_roots = self.server.balance_roots(
int(self.params.first('cutoff') or '0'))
self.send_rendered(Path('balance.tmpl'),
ctx | {'roots': balance_roots, 'valid': valid})
- elif self.pagename in {'booking', 'edit_structured'}:
+ elif self.pagename == 'booking':
+ self.redirect(
+ Path('/').joinpath('edit_structured').joinpath(str(id_)))
+ elif self.pagename == 'edit_structured':
ctx['dat_lines'] = [dl.as_dict for dl
in self.server.bookings[ctx['id']].dat_lines]
self.send_rendered(Path('edit_structured.tmpl'), ctx)