home · contact · privacy
Redirect /booking/{id} to /edit_structured/{id} for now.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 28 Jan 2025 12:23:59 +0000 (13:23 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 28 Jan 2025 12:23:59 +0000 (13:23 +0100)
ledger.py

index a553fc2a46791cd6e1d0705c7d9cceea80d86160..d25462867d42d4f7a11bc4c627130e2e7cbc97c5 100755 (executable)
--- 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)