From 687928ead25cb8f62fdfc58c2e126264e0fb149a Mon Sep 17 00:00:00 2001 From: joey Date: Tue, 8 May 2007 21:22:14 +0000 Subject: [PATCH 1/1] * Make testpagespec more robust, including checking for missing/bad parameters, and detecting if a pagespec failed to compile. --- IkiWiki/Plugin/testpagespec.pm | 9 +++++++++ debian/changelog | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index 4966f4e10..a0bb2ff31 100644 --- a/IkiWiki/Plugin/testpagespec.pm +++ b/IkiWiki/Plugin/testpagespec.pm @@ -12,6 +12,12 @@ sub import { #{{{ sub preprocess (@) { #{{{ my %params=@_; + foreach my $param (qw{match pagespec}) { + if (! exists $params{$param}) { + return "[[testpagespec missing $param parameter]]"; + } + } + add_depends($params{page}, $params{pagespec}); my $ret=pagespec_match($params{match}, $params{pagespec}, @@ -19,6 +25,9 @@ sub preprocess (@) { #{{{ if ($ret) { return "match: $ret"; } + elsif (! defined $ret) { + return "match failed: $@"; + } else { return "no match: $ret"; } diff --git a/debian/changelog b/debian/changelog index 25d36abc5..7da9b9c66 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,8 +7,10 @@ ikiwiki (2.1) UNRELEASED; urgency=low * Fix a bug that prevented clearing email or subscriptions. * Improve handling of edits of locked pages by users who are not yet signed in. + * Make testpagespec more robust, including checking for missing/bad + parameters, and detecting if a pagespec failed to compile. - -- Joey Hess Mon, 07 May 2007 02:02:53 -0400 + -- Joey Hess Tue, 08 May 2007 17:21:13 -0400 ikiwiki (2.00) unstable; urgency=low -- 2.44.0