[rt-commit] [svn] r604 - in rt/branches/rt-3.1: . lib/RT
jesse at fsck.com
jesse at fsck.com
Fri Mar 19 01:46:22 EST 2004
Author: jesse
Date: Fri Mar 19 01:46:21 2004
New Revision: 604
Modified:
rt/branches/rt-3.1/ (props changed)
rt/branches/rt-3.1/lib/RT/Attribute_Overlay.pm
rt/branches/rt-3.1/lib/RT/CurrentUser.pm
Log:
Fixes for running on postgres
----------------------------------------------------------------------
Modified: rt/branches/rt-3.1/lib/RT/Attribute_Overlay.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/Attribute_Overlay.pm (original)
+++ rt/branches/rt-3.1/lib/RT/Attribute_Overlay.pm Fri Mar 19 01:46:21 2004
@@ -21,10 +21,11 @@
#
#
# END LICENSE BLOCK
+
use strict;
no warnings qw(redefine);
use Storable qw/nfreeze thaw/;
-
+use MIME::Base64;
=head1 NAME
@@ -203,7 +204,7 @@
my $content = shift;
my $hashref;
- eval {$hashref = thaw($content)} ;
+ eval {$hashref = thaw(decode_base64($content))} ;
if ($@) {
$RT::Logger->error("Deserialization of attribute ".$self->Id. " failed");
}
@@ -237,7 +238,7 @@
sub _SerializeContent {
my $self = shift;
my $content = shift;
- return( nfreeze($content));
+ return( encode_base64(nfreeze($content)));
}
@@ -359,8 +360,8 @@
my $object_type = $self->__Value('ObjectType');
my $object;
eval { $object = $object_type->new($self->CurrentUser) };
- if ($@) {
- $RT::Logger->error("Attribute ".$self->Id." has a bogus object type");
+ unless(UNIVERSAL::isa($object, $object_type)) {
+ $RT::Logger->error("Attribute ".$self->Id." has a bogus object type - $object_type (".$@.")");
return(undef);
}
$object->Load($self->__Value('ObjectId'));
Modified: rt/branches/rt-3.1/lib/RT/CurrentUser.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/CurrentUser.pm (original)
+++ rt/branches/rt-3.1/lib/RT/CurrentUser.pm Fri Mar 19 01:46:21 2004
@@ -59,16 +59,30 @@
# to be a CurrentUser object. but that's hard to do when we're trying to load
# the CurrentUser object
-sub _Init {
- my $self = shift;
- my $Name = shift;
+sub _Init {
+ my $self = shift;
+ my $User = shift;
- $self->{'table'} = "Users";
+ $self->{'table'} = "Users";
- if (defined($Name)) {
- $self->Load($Name);
- }
- $self->_BuildTableAttributes();
+ if ( defined($User) ) {
+
+ if ( UNIVERSAL::isa( $User, 'RT::User' )
+ || UNIVERSAL::isa( $User, 'RT::CurrentUser' ) )
+ {
+ $self->Load( $User->id );
+
+ }
+ elsif ( ref($User) ) {
+ $RT::Logger->crit(
+ "RT::CurrentUser->new() called with a bogus argument: $User");
+ }
+ else {
+ $self->Load($User);
+ }
+ }
+
+ $self->_BuildTableAttributes();
}
# }}}
More information about the Rt-commit
mailing list