From: <de...@de...> - 2007-12-30 10:22:15
|
Author: CrawfordCurrie Date: 2007-12-30 04:22:20 -0600 (Sun, 30 Dec 2007) New Revision: 16120 Trac url: http://develop.twiki.org/trac/changeset/16120 Modified: twiki/branches/MAIN/lib/TWiki.pm twiki/branches/MAIN/lib/TWiki/UI/Save.pm Log: Item5182: throw exception if tempate topic does not exist Modified: twiki/branches/MAIN/lib/TWiki/UI/Save.pm =================================================================== --- twiki/branches/MAIN/lib/TWiki/UI/Save.pm 2007-12-30 10:20:08 UTC (rev 16119) +++ twiki/branches/MAIN/lib/TWiki/UI/Save.pm 2007-12-30 10:22:20 UTC (rev 16120) @@ -107,6 +107,20 @@ my $templatetopic = $query->param( 'templatetopic'); my $templateweb = $webName; + if( $templatetopic ) { + ( $templateweb, $templatetopic ) = + $session->normalizeWebTopicName( $templateweb, $templatetopic ); + + unless( $store->topicExists( $templateweb, $templatetopic )) { + throw TWiki::OopsException( + 'attention', + def => 'no_such_topic', + web => $templateweb, + topic => $templatetopic, + params => [ 'template from' ] ); + } + } + if( $topicExists ) { ( $prevMeta, $prevText ) = $store->readTopic( $user, $webName, $topic, $revision ); @@ -119,9 +133,6 @@ } } } elsif ($templatetopic) { - ( $templateweb, $templatetopic ) = - $session->normalizeWebTopicName( $templateweb, $templatetopic ); - ( $templateMeta, $templateText ) = $store->readTopic( $user, $templateweb, $templatetopic, $revision ); Modified: twiki/branches/MAIN/lib/TWiki.pm =================================================================== --- twiki/branches/MAIN/lib/TWiki.pm 2007-12-30 10:20:08 UTC (rev 16119) +++ twiki/branches/MAIN/lib/TWiki.pm 2007-12-30 10:22:20 UTC (rev 16120) @@ -2411,6 +2411,14 @@ $text =~ s/%([\da-f]{2})/chr(hex($1))/gei; + # Item4946: support chars in %u format + $text =~ s/%u([\da-f]{4})/chr(hex($1))/gei; + # chr($unicode_codepoint) works w/o a pragma in Perl 5.8 and 5.6 + unless( $TWiki::cfg{Site}{CharSet} =~ /^utf-?8$/i ) { + my $t = UTF82SiteCharSet( $text ); + $text = $t if ( $t ); + } + return $text; } |