From: Chris W. <la...@us...> - 2005-02-13 20:28:50
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5334/lib/OpenInteract2 Modified Files: Context.pm Log Message: modify how the none/not_found actions are brought in since we modified the server configuration slightly; some cosmetic error/debugging message fixes Index: Context.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Context.pm,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** Context.pm 2 Feb 2005 13:06:01 -0000 1.82 --- Context.pm 13 Feb 2005 20:28:41 -0000 1.83 *************** *** 345,351 **** unless ( $action_info ) { ! $log_act->error( "Action '$action_name' not found in action table" ); ! OpenInteract2::Exception->throw( ! "Action '$action_name' not found in action table" ); } --- 345,351 ---- unless ( $action_info ) { ! my $msg = "Action '$action_name' not found in action table" ; ! $log_act->error( $msg ); ! OpenInteract2::Exception->throw( $msg ); } *************** *** 378,424 **** my $action_info = $self->lookup_action_info( $action_name ); unless ( $action_info ) { ! $log_act->error( "No action found for '$action_name'" ); ! OpenInteract2::Exception->throw( ! "No action defined for '$action_name'" ); } return OpenInteract2::Action->new( $action_info, $props ); } - sub lookup_action_none { my ( $self ) = @_; ! $log_act ||= get_logger( LOG_ACTION ); ! my $action_info = $self->server_config->{action_info}{none}; ! unless ( $action_info ) { ! $log_act->error( "Please define the server configuration entry ", ! "under 'action_info.none'" ); ! OpenInteract2::Exception->throw( ! "The 'none' item under 'action_info' is not defined. ", ! "Please check your server configuration." ); ! } ! if ( my $action_name = $action_info->{redir} ) { ! return $self->lookup_action( $action_name ); ! } ! return OpenInteract2::Action->new( $action_info ); } - sub lookup_action_not_found { my ( $self ) = @_; ! $log_act ||= get_logger( LOG_ACTION ); ! my $action_info = $self->server_config->{action_info}{not_found}; ! unless ( $action_info ) { ! $log_act->error( "Please define the server configuration entry ", ! "under 'action_info.not_found'" ); ! OpenInteract2::Exception->throw( ! "The 'not_found' item under 'action_info' is not ", ! "defined. Please check your server configuration." ); ! } ! if ( my $action_name = $action_info->{redir} ) { ! return $self->lookup_action( $action_name ); ! } ! return OpenInteract2::Action->new( $action_info ); } sub lookup_default_action_info { --- 378,417 ---- my $action_info = $self->lookup_action_info( $action_name ); unless ( $action_info ) { ! my $msg = "No action found for '$action_name'"; ! $log_act->error( $msg ); ! OpenInteract2::Exception->throw( $msg ); } return OpenInteract2::Action->new( $action_info, $props ); } sub lookup_action_none { my ( $self ) = @_; ! my $action_name = $self->server_config->{action_info}{none}; ! return $self->_create_action_from_name( ! $action_name, 'action_info.none' ! ); } sub lookup_action_not_found { my ( $self ) = @_; ! my $action_name = $self->server_config->{action_info}{not_found}; ! return $self->_create_action_from_name( ! $action_name, 'action_info.not_found' ! ); } + sub _create_action_from_name { + my ( $self, $name, $key ) = @_; + unless ( $name ) { + my $msg = join( '', + "Check your server configuration -- you must define an ", + "action number in your server configuration under '$key'" + ); + $log_act ||= get_logger( LOG_ACTION ); + $log_act->error( $msg ); + OpenInteract2::Exception->throw( $msg ); + } + return $self->lookup_action( $name ); + } sub lookup_default_action_info { *************** *** 435,441 **** $log_spops ||= get_logger( LOG_SPOPS ); unless ( $object_name ) { ! $log_spops->error( "Must lookup object class using name" ); ! OpenInteract2::Exception->throw( ! "Cannot lookup object class without object name" ); } my $spops_config = $self->spops_config; --- 428,434 ---- $log_spops ||= get_logger( LOG_SPOPS ); unless ( $object_name ) { ! my $msg = "Cannot lookup object class without object name"; ! $log_spops->error( $msg ); ! OpenInteract2::Exception->throw( $msg ); } my $spops_config = $self->spops_config; |