From: Christian Heller Date: Tue, 28 Jan 2025 12:23:59 +0000 (+0100) Subject: Redirect /booking/{id} to /edit_structured/{id} for now. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/%7Broute%7D?a=commitdiff_plain;h=3e0d8acb51fc2131f978410d71908f781ea97b51;p=plomledger Redirect /booking/{id} to /edit_structured/{id} for now. --- diff --git a/ledger.py b/ledger.py index a553fc2..d254628 100755 --- a/ledger.py +++ b/ledger.py @@ -300,13 +300,18 @@ class Handler(PlomHttpHandler): # 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)