Permalink
Browse files

Item13986: Fix bug discovered in prefs and meta

This was masked by a bug in the unit test.  Thanks to VadimBelman for
the fix.
  • Loading branch information...
1 parent 62d92f1 commit 9e6a2679b4402e9ba324a05f6a361cb10361e69f @gac410 gac410 committed Nov 1, 2016
Showing with 25 additions and 3 deletions.
  1. +4 −3 UnitTestContrib/test/unit/PluginHandlerTests.pm
  2. +1 −0 core/lib/Foswiki/Meta.pm
  3. +20 −0 core/lib/Foswiki/Prefs.pm
@@ -188,7 +188,7 @@ sub beforeSaveHandler {
$tester->assert_str_equals($tester->{test_web}, $_[2], "THREE $_[2]");
$tester->assert($_[3]->isa('Foswiki::Meta'), "FOUR $_[3]");
$tester->assert_str_equals('Wibble', $_[3]->get('WIBBLE')->{wibble});
- Foswiki::Func::pushTopicContext( $this->{test_web}, 'Tropic' );
+ Foswiki::Func::pushTopicContext( $tester->{test_web}, 'Tropic' );
$tester->assert_str_equals( "BEFORE",
$_[3]->getPreference("BLAH"));
#Foswiki::Func::getPreferencesValue("BLAH") );
@@ -833,8 +833,9 @@ HERE
my $hashRef = eval
"\$Foswiki::Plugins::$this->{plugin_name}::called->{renderWikiWordHandlerLinks}";
use Data::Dumper;
- print STDERR "------ $html\n";
- print STDERR "------ " . Dumper($hashRef) . "\n";
+
+ #print STDERR "------ $html\n";
+ #print STDERR "------ " . Dumper($hashRef) . "\n";
#this is what we have - and it shows that you need to call expandMacros before calling renderText
$this->assert_deep_equals(
@@ -1188,6 +1188,7 @@ sub text {
_assertIsTopic($this) if DEBUG;
if ( defined($val) ) {
$this->{_text} = $val;
+ $this->{_session}->{prefs}->invalidatePath($this);
}
else {
@@ -1,6 +1,7 @@
# See bottom of file for license and copyright information
use strict;
use warnings;
+use Error;
BEGIN {
if ( $Foswiki::cfg{UseLocale} ) {
@@ -252,6 +253,25 @@ sub loadPreferences {
return $obj;
}
+sub invalidatePath {
+ my $this = shift;
+ my $path;
+ if ( ref( $_[0] ) ) {
+ ASSERT( $_[0]->isa('Foswiki::Meta') ) if DEBUG;
+ $path = $_[0]->getPath;
+ }
+ else {
+ $path = $_[0];
+ }
+
+ if ( $this->{paths}->{$path} ) {
+
+ #print STDERR "INVALIDATED: $this->{paths}->{$path}\n";
+ delete $this->{paths}->{$path};
+ }
+
+}
+
=begin TML
---++ ObjectMethod pushTopicContext( $web, $topic )

0 comments on commit 9e6a267

Please sign in to comment.