Skip to content

Commit

Permalink
Item10987: simpler version of Paul's hack - if the incoming object is…
Browse files Browse the repository at this point in the history
…n't a simple Meta obj, return it after using the mongodb load. I'm going to have yet another attempt at extracting the load from fowswiki txt format code so that the entire reblessing thing can go away

git-svn-id: http://svn.foswiki.org/trunk/MongoDBPlugin@12322 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Aug 17, 2011
1 parent b0ea3a3 commit 7caaf0c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/Foswiki/Plugins/MongoDBPlugin/Listener.pm
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,20 @@ sub loadTopic {
}

#rebless into a mighter version of Meta
#TODO: none of this horrid monkeying should be needed
#the proper fix will be to separate (de)serialization from meta and store, so they can be mixin/aspect/something
my $metaClass = ref($_[1]);
bless( $_[1], 'Foswiki::Plugins::MongoDBPlugin::Meta' );
$_[1]->reload(); #get the latest version
$_[1]->{_latestIsLoaded} = 1;
if ( $_[1]->topic =~ /Form$/ ) {
# use Foswiki::Form;
# bless( $_[1], 'Foswiki::Form' );
if ( $metaClass ne 'Foswiki::Meta' ) {
#return us to what we were..
bless( $_[1], $metaClass );

# $session->{forms}->{ $_[1]->web . '.' . $_[1]->topic } = $_[1];
print STDERR "------ init Form obj\n" if MONITOR;
print STDERR "------ rebless to $metaClass\n" if MONITOR;
}

#cache the metaObj
$session->search->metacache->addMeta( $_[1]->web, $_[1]->topic, $_[1] );

print STDERR "===== loadTopic("
Expand Down

0 comments on commit 7caaf0c

Please sign in to comment.