|
From: Chris W. <la...@us...> - 2001-10-22 11:50:08
|
Update of /cvsroot/openinteract/SPOPS/SPOPS
In directory usw-pr-cvs1:/tmp/cvs-serv344
Modified Files:
DBI.pm GDBM.pm LDAP.pm
Log Message:
all calls to 'new()' when fetching objects should be accompanied by
'skip_default_values'
Index: DBI.pm
===================================================================
RCS file: /cvsroot/openinteract/SPOPS/SPOPS/DBI.pm,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** DBI.pm 2001/10/12 21:00:26 1.51
--- DBI.pm 2001/10/22 11:50:00 1.52
***************
*** 226,231 ****
# it; if not, check to see if we can whip up a cached object
! if ( $p->{data} ) {
! $obj = $class->new( $p->{data} );
}
else {
--- 226,231 ----
# it; if not, check to see if we can whip up a cached object
! if ( ref $p->{data} eq 'HASH' ) {
! $obj = $class->new({ %{ $p->{data} }, skip_default_values => 1 });
}
else {
***************
*** 268,272 ****
# a parameter of an object -- THAT would be fun to debug...
! $obj = $class->new( { id => $id, %{ $p } } );
$obj->_fetch_assign_row( $raw_fields, $row, $p );
}
--- 268,272 ----
# a parameter of an object -- THAT would be fun to debug...
! $obj = $class->new( { id => $id, skip_default_values => 1, %{ $p } } );
$obj->_fetch_assign_row( $raw_fields, $row, $p );
}
Index: GDBM.pm
===================================================================
RCS file: /cvsroot/openinteract/SPOPS/SPOPS/GDBM.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** GDBM.pm 2001/10/12 21:00:26 1.13
--- GDBM.pm 2001/10/22 11:50:00 1.14
***************
*** 19,23 ****
my $C = $class->CONFIG;
if ( ref $C->{field} eq 'HASH' ) {
! $C->{field_list} = [ sort{ $C->{field}->{$a} <=> $C->{field}->{$b} } keys %{ $C->{field} } ];
}
$class->_class_initialize( $CONFIG ); # allow subclasses to do their own thing
--- 19,23 ----
my $C = $class->CONFIG;
if ( ref $C->{field} eq 'HASH' ) {
! $C->{field_list} = [ sort{ $C->{field}{$a} <=> $C->{field}{$b} } keys %{ $C->{field} } ];
}
$class->_class_initialize( $CONFIG ); # allow subclasses to do their own thing
***************
*** 81,90 ****
$gdbm_filename = $item->{tmp_gdbm_filename};
}
! if ( $item->CONFIG->{gdbm_info}->{file_fragment} and $p->{directory} ) {
DEBUG() && _w( 1, "Found file fragent and directory" );
! $gdbm_filename ||= join( '/', $p->{directory}, $item->CONFIG->{gdbm_info}->{file_fragment} );
}
! $gdbm_filename ||= $item->CONFIG->{gdbm_info}->{filename};
! $gdbm_filename ||= $item->global_config->{gdbm_info}->{filename};
}
DEBUG() && _w( 1, "Trying file $gdbm_filename to connect" );
--- 81,90 ----
$gdbm_filename = $item->{tmp_gdbm_filename};
}
! if ( $item->CONFIG->{gdbm_info}{file_fragment} and $p->{directory} ) {
DEBUG() && _w( 1, "Found file fragent and directory" );
! $gdbm_filename ||= join( '/', $p->{directory}, $item->CONFIG->{gdbm_info}{file_fragment} );
}
! $gdbm_filename ||= $item->CONFIG->{gdbm_info}{filename};
! $gdbm_filename ||= $item->global_config->{gdbm_info}{filename};
}
DEBUG() && _w( 1, "Trying file $gdbm_filename to connect" );
***************
*** 137,141 ****
return undef unless ( $item_info );
my $data = undef;
! {
no strict 'vars';
$data = eval $item_info;
--- 137,141 ----
return undef unless ( $item_info );
my $data = undef;
! {
no strict 'vars';
$data = eval $item_info;
***************
*** 145,161 ****
}
! # Retreive an object
sub fetch {
my ( $class, $id, $p ) = @_;
! my $data = $p->{data};
unless ( $data ) {
return undef unless ( $id and $id !~ /^tmp/ );
return undef unless ( $class->pre_fetch_action( { id => $id } ) );
! $data = $class->_return_structure_for_key( $class->object_key( $id ),
! { filename => $p->{filename},
directory => $p->{directory} } );
! }
! my $obj = $class->new( $data );
$obj->clear_change;
return undef unless ( $class->post_fetch_action );
--- 145,161 ----
}
! # Retreive an object
sub fetch {
my ( $class, $id, $p ) = @_;
! my $data = $p->{data} || {};
unless ( $data ) {
return undef unless ( $id and $id !~ /^tmp/ );
return undef unless ( $class->pre_fetch_action( { id => $id } ) );
! $data = $class->_return_structure_for_key( $class->object_key( $id ),
! { filename => $p->{filename},
directory => $p->{directory} } );
! }
! my $obj = $class->new({ %{ $data }, skip_default_values => 1 });
$obj->clear_change;
return undef unless ( $class->post_fetch_action );
***************
*** 177,181 ****
next unless ( $data );
push @objects, $class->fetch( undef, { data => $data } );
! }
return \@objects;
}
--- 177,181 ----
next unless ( $data );
push @objects, $class->fetch( undef, { data => $data } );
! }
return \@objects;
}
***************
*** 194,198 ****
}
return undef unless ( $self->pre_save_action( { is_add => $is_add } ) );
!
# Build the data and dump to string
--- 194,198 ----
}
return undef unless ( $self->pre_save_action( { is_add => $is_add } ) );
!
# Build the data and dump to string
***************
*** 200,204 ****
local $Data::Dumper::Indent = 0;
my $obj_string = Data::Dumper->Dump( [ \%data ], [ 'data' ] );
!
# Save to DB
--- 200,204 ----
local $Data::Dumper::Indent = 0;
my $obj_string = Data::Dumper->Dump( [ \%data ], [ 'data' ] );
!
# Save to DB
***************
*** 282,286 ****
B<global_gdbm_tie( \%params )>
! Returns a tied hashref if successful.
There are many different ways of creating a filename used for
--- 282,286 ----
B<global_gdbm_tie( \%params )>
! Returns a tied hashref if successful.
There are many different ways of creating a filename used for
***************
*** 337,341 ****
In the config file just joins the 'name' and 'version' parameters of
! an object and returns the result.
B<object_key>
--- 337,341 ----
In the config file just joins the 'name' and 'version' parameters of
! an object and returns the result.
B<object_key>
Index: LDAP.pm
===================================================================
RCS file: /cvsroot/openinteract/SPOPS/SPOPS/LDAP.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** LDAP.pm 2001/10/12 21:00:26 1.30
--- LDAP.pm 2001/10/22 11:50:01 1.31
***************
*** 186,190 ****
DEBUG() && _wm( 1, "Single entry found ok; setting values into object",
"(Delay security: $info->{delay_security_check})" );
! my $obj = $class->new;
$obj->_fetch_assign_row( undef, $entry );
if ( $info->{delay_security_check} && ! $p->{skip_security} ) {
--- 186,190 ----
DEBUG() && _wm( 1, "Single entry found ok; setting values into object",
"(Delay security: $info->{delay_security_check})" );
! my $obj = $class->new({ skip_default_values => 1 });
$obj->_fetch_assign_row( undef, $entry );
if ( $info->{delay_security_check} && ! $p->{skip_security} ) {
***************
*** 250,254 ****
$class->_check_error( $p->{ldap_msg}, 'Error trying to run LDAP search' );
}
! return SPOPS::Iterator::LDAP->new( $p );
}
--- 250,254 ----
$class->_check_error( $p->{ldap_msg}, 'Error trying to run LDAP search' );
}
! return SPOPS::Iterator::LDAP->new( { %{ $p }, skip_default_values => 1 });
}
***************
*** 266,270 ****
ENTRY:
while ( my $entry = $ldap_msg->shift_entry ) {
! my $obj = $class->new;
$obj->_fetch_assign_row( undef, $entry );
my $level = ( $p->{skip_security} )
--- 266,270 ----
ENTRY:
while ( my $entry = $ldap_msg->shift_entry ) {
! my $obj = $class->new({ skip_default_values => 1 });
$obj->_fetch_assign_row( undef, $entry );
my $level = ( $p->{skip_security} )
|