Skip to content

Commit

Permalink
Item13897: Bug fixes.
Browse files Browse the repository at this point in the history
Made Foswiki::Meta session attribute public.
  • Loading branch information
vrurg committed Jan 27, 2016
1 parent f7b7053 commit cd9a15e
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 140 deletions.
2 changes: 1 addition & 1 deletion PreferencesPlugin/lib/Foswiki/Plugins/PreferencesPlugin.pm
Expand Up @@ -57,7 +57,7 @@ sub beforeCommonTagsHandler {
# SMELL: Unpublished API. No choice, though :-(
require Foswiki::Form; # SMELL
$formDef =
new Foswiki::Form( $Foswiki::Plugins::SESSION, $formWeb, $form );
Foswiki::Form->load( $Foswiki::Plugins::SESSION, $formWeb, $form );
}

my $query = Foswiki::Func::getCgiQuery();
Expand Down
22 changes: 12 additions & 10 deletions core/lib/Foswiki/Form.pm
Expand Up @@ -143,7 +143,7 @@ sub load {
return $this // $class->new(
session => $session,
web => $vweb,
topic => $vtopic,
form => $vtopic,
_via_load => 1,
( defined $def ? ( def => $def ) : () ),
);
Expand All @@ -159,6 +159,9 @@ around BUILDARGS => sub {
my ( $vweb, $vtopic ) =
_validateWebTopic( $session, $params->{web}, $params->{form} );

# Cast form into topic to as our base Foswiki::Meta knows it.
$params->{topic} = $vtopic;

# Avoid direct calls to $class::new().
ASSERT( $params->{_via_load},
"${class}::new() has been use directly. Use ${class}::load() instead."
Expand Down Expand Up @@ -300,12 +303,6 @@ sub _parseFormDefinition {
my $text = $this->text();
$text = '' unless defined $text;

{

package Foswiki::Form::ParseFinished;
our @ISA = ('Error');
}

# Valid column titles, in default order.
my @columns = @default_columns;
my $col = 0;
Expand Down Expand Up @@ -357,7 +354,7 @@ sub _parseFormDefinition {
if ( $event eq 'close_table' ) {

# Abort the parse after the first table has been read
throw Foswiki::Form::ParseFinished;
Foswiki::Form::ParseFinished->throw;
}

if ( $event eq 'close_tr' ) {
Expand Down Expand Up @@ -443,7 +440,7 @@ sub _parseFormDefinition {
}
catch {

if ( $_->isa('Foswiki::Form::ParseFinished ') ) {
if ( $_->isa('Foswiki::Form::ParseFinished') ) {

# clean exit, fired when first table has been parsed
}
Expand Down Expand Up @@ -483,7 +480,7 @@ sub createField {
require Foswiki::Form::FieldDefinition;
$class = 'Foswiki::Form::FieldDefinition';
}
return $class->new( session => $this->session(), type => $type, @_ );
return $class->new( session => $this->session, type => $type, @_ );
}

# Generate a link to the given topic, so we can bring up details in a
Expand Down Expand Up @@ -829,6 +826,11 @@ sub _extractPseudoFieldDefs {
return \@fieldDefs;
}

1;

package Foswiki::Form::ParseFinished;
use Moo;
extends qw( Foswiki::Exception );
1;
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Expand Down

0 comments on commit cd9a15e

Please sign in to comment.