~mdw
/
bridge-toys
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mason/dhandler: Bring not-found handling into the dhandler.
[bridge-toys]
/
mason
/
dhandler
diff --git
a/mason/dhandler
b/mason/dhandler
index
d7c1da5
..
59d5e3e
100755
(executable)
--- a/
mason/dhandler
+++ b/
mason/dhandler
@@
-41,15
+41,32
@@
$nrow => 4
</%args>
%#
$nrow => 4
</%args>
%#
-<%method title>Single hand</%method>
+<%method title>\
+% if ($fail) {
+Not found\
+% } else {
+Single hand\
+% }
+</%method>
+%#
+<%def .not-found>
+<h1>Not found</h1>
+Failed to find ‘<code><% $what |h %></code>’.
+% return 404;
+<%args>
+ $what
+</%args>
+</%def>
%#
<%once>
use Deal;
</%once>
%#
%#
<%once>
use Deal;
</%once>
%#
+<%shared>
+ my $fail = ($m->dhandler_arg ne "");
+</%shared>
+%#
<%init>
<%init>
- unless ($m->dhandler_arg eq "") {
- $m->clear_buffer;
- $m->comp("%not-found", what => $m->dhandler_arg);
- }
+ return $m->comp(".not-found", what => $m->dhandler_arg)
+ if $fail;
</%init>
</%init>