From b2dea99417ebfee3d448ab6b49ca58cb2780258d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 2 May 2008 13:02:07 -0400 Subject: Fix ugly display when editing a page that has vanished. srcfile now has an optional second parameter to avoid it throwing an error if the source file does not exist. --- IkiWiki/CGI.pm | 2 +- IkiWiki/Plugin/shortcut.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 65136a269..781974c13 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -503,7 +503,7 @@ sub cgi_editpage ($$) { #{{{ my $exists=-e "$config{srcdir}/$file"; if ($form->field("do") ne "create" && ! $exists && - ! eval { srcfile($file) }) { + ! defined srcfile($file, 1)) { $form->tmpl_param("page_gone", 1); $form->field(name => "do", value => "create", force => 1); $form->tmpl_param("page_select", 0); diff --git a/IkiWiki/Plugin/shortcut.pm b/IkiWiki/Plugin/shortcut.pm index c3e1f5446..f1a38ea48 100644 --- a/IkiWiki/Plugin/shortcut.pm +++ b/IkiWiki/Plugin/shortcut.pm @@ -13,7 +13,7 @@ sub import { #{{{ sub checkconfig () { #{{{ # Preprocess the shortcuts page to get all the available shortcuts # defined before other pages are rendered. - my $srcfile=eval {srcfile("shortcuts.mdwn")}; + my $srcfile=srcfile("shortcuts.mdwn", 1); if (! defined $srcfile) { error(gettext("shortcut plugin will not work without a shortcuts.mdwn")); } -- cgit v1.2.3