[Rt-commit] r9183 - in rt/branches/3.999-DANGEROUS: . html lib lib/RT lib/RT/ScripAction

jesse at bestpractical.com jesse at bestpractical.com
Sun Sep 30 02:28:05 EDT 2007


Author: jesse
Date: Sun Sep 30 02:28:03 2007
New Revision: 9183

Modified:
   rt/branches/3.999-DANGEROUS/   (props changed)
   rt/branches/3.999-DANGEROUS/html/autohandler
   rt/branches/3.999-DANGEROUS/lib/RT.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/Attachment.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/Scrip.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/Template.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/TemplateCollection.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Record.pm
   rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Notify.pm

Log:
 r67637 at pinglin:  jesse | 2007-09-30 02:27:41 -0400
 Refactoring toward tests passing.
 
 Failed 15/93 test scripts. 721/3736 subtests failed.
 


Modified: rt/branches/3.999-DANGEROUS/html/autohandler
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/autohandler	(original)
+++ rt/branches/3.999-DANGEROUS/html/autohandler	Sun Sep 30 02:28:03 2007
@@ -82,7 +82,6 @@
     $session{'CurrentUser'} = RT::CurrentUser->new;
 }
 
-warn "My currentuser is ".$session{'CurrentUser'};
 
 # Set the proper encoding for the current language handle
 $r->content_type("text/html; charset=utf-8");

Modified: rt/branches/3.999-DANGEROUS/lib/RT.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT.pm	Sun Sep 30 02:28:03 2007
@@ -248,7 +248,7 @@
                          ));
         }
     }
-
+}
 
 # Signal handlers
 ## This is the default handling of warnings and die'ings in the code
@@ -256,29 +256,6 @@
 ## Mason).  It will log all problems through the standard logging
 ## mechanism (see above).
 
-    $SIG{__WARN__} = sub {
-        # The 'wide character' warnings has to be silenced for now, at least
-        # until HTML::Mason offers a sane way to process both raw output and
-        # unicode strings.
-        # use 'goto &foo' syntax to hide ANON sub from stack
-        if( index($_[0], 'Wide character in ') != 0 ) {
-            unshift @_, $RT::Logger, qw(level warning message);
-            goto &Log::Dispatch::log;
-        }
-    };
-
-#When we call die, trap it and log->crit with the value of the die.
-
-    $SIG{__DIE__}  = sub {
-        # if we are not in eval and perl is not parsing code
-        # then rollback transactions and log RT error
-        unless ($^S || !defined $^S ) {
-            Jifty->handle->rollback(1) if Jifty->handle;
-            $RT::Logger->crit("$_[0]") if $RT::Logger;
-        }
-        die $_[0];
-    };
-}
 
 
 sub CheckPerlRequirements {

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Attachment.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Attachment.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Attachment.pm	Sun Sep 30 02:28:03 2007
@@ -295,7 +295,7 @@
 sub ContentLength {
     my $self = shift;
 
-    return undef unless $self->TransactionObj->current_userCanSee;
+    return undef unless $self->TransactionObj->current_user_can_see;
 
     my $len = $self->GetHeader('Content-Length');
     unless ( defined $len ) {
@@ -583,7 +583,7 @@
         return ( $self->__value( $field, @_ ) );
     }
 
-    return undef unless $self->TransactionObj->current_userCanSee;
+    return undef unless $self->TransactionObj->current_user_can_see;
     return $self->__value( $field, @_ );
 }
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm	Sun Sep 30 02:28:03 2007
@@ -348,6 +348,7 @@
         @_
     );
 
+
     unless ( $self->current_user->has_right(Right => 'AdminQueue', Object => RT->System) )
     {    #Check them ACLs
         return ( 0, $self->loc("No permission to create queues") );

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Scrip.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Scrip.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Scrip.pm	Sun Sep 30 02:28:03 2007
@@ -449,15 +449,12 @@
                                       TicketObj      => $args{'TicketObj'},
                                       TransactionObj => $args{'TransactionObj'},
         );
-
         $return = $self->ActionObj->prepare();
     };
-    if ($@) {
-        $RT::Logger->error( "Scrip prepare " . $self->id . " died. - " . $@ );
+    if (my $err = $@) {
+        $RT::Logger->error( "Scrip prepare " . $self->id . " died. - " . $err ." ".$self->ActionObj->ExecModule);
         return (undef);
     }
-        unless ($return) {
-        }
         return ($return);
 }
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Template.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Template.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Template.pm	Sun Sep 30 02:28:03 2007
@@ -50,7 +50,7 @@
 sub _set {
     my $self = shift;
     
-    unless ( $self->current_userHasQueueRight('ModifyTemplate') ) {
+    unless ( $self->current_user_has_queue_right('ModifyTemplate') ) {
         return ( 0, $self->loc('Permission Denied') );
     }
     return $self->SUPER::_set( @_ );
@@ -74,7 +74,7 @@
 sub _value {
     my $self  = shift;
 
-    unless ( $self->current_userHasQueueRight('ShowTemplate') ) {
+    unless ( $self->current_user_has_queue_right('ShowTemplate') ) {
         return undef;
     }
     return $self->__value( @_ );
@@ -210,7 +210,7 @@
 sub delete {
     my $self = shift;
 
-    unless ( $self->current_userHasQueueRight('ModifyTemplate') ) {
+    unless ( $self->current_user_has_queue_right('ModifyTemplate') ) {
         return ( 0, $self->loc('Permission Denied') );
     }
 
@@ -383,15 +383,15 @@
 
 # }}}
 
-# {{{ sub CurrentUserHasQueueRight
+# {{{ sub current_user_has_queue_right
 
-=head2 CurrentUserHasQueueRight
+=head2 current_user_has_queue_right
 
-Helper function to call the template's queue's CurrentUserHasQueueRight with the passed in args.
+Helper function to call the template's queue's current_user_has_queue_right with the passed in args.
 
 =cut
 
-sub CurrentUserHasQueueRight {
+sub current_user_has_queue_right {
     my $self = shift;
     return ( $self->QueueObj->current_user_has_right(@_) );
 }

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/TemplateCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/TemplateCollection.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/TemplateCollection.pm	Sun Sep 30 02:28:03 2007
@@ -175,7 +175,7 @@
         
         # If it's part of a queue, and the user can read templates in
         # that queue, or the user can globally read templates, show it
-        if ($templ->Queue && $templ->current_userHasQueueRight('ShowTemplate') or
+        if ($templ->Queue && $templ->current_user_has_queue_right('ShowTemplate') or
             $templ->current_user->has_right(Object => RT->System, Right => 'ShowTemplate')) {
 	    return($templ);
 	}

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm	Sun Sep 30 02:28:03 2007
@@ -2531,7 +2531,7 @@
     }
 
     # update all the links that point to that old ticket
-    my $old_links_to = RT::Model::LinkCollection->new($self->current_user);
+    my $old_links_to = RT::Model::LinkCollection->new(current_user => $self->current_user);
     $old_links_to->limit(column => 'Target', value => $self->URI);
 
     my %old_seen;
@@ -2556,7 +2556,7 @@
 
     }
 
-    my $old_links_from = RT::Model::LinkCollection->new($self->current_user);
+    my $old_links_from = RT::Model::LinkCollection->new(current_user=> $self->current_user);
     $old_links_from->limit(column => 'Base', value => $self->URI);
 
     while (my $link = $old_links_from->next) {

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm	Sun Sep 30 02:28:03 2007
@@ -640,7 +640,7 @@
 sub set_RandomPassword {
     my $self = shift;
 
-    unless ( $self->current_userCanModify('Password') ) {
+    unless ( $self->current_user_can_modify('Password') ) {
         return ( 0, $self->loc("Permission Denied") );
     }
 
@@ -679,7 +679,7 @@
 sub ResetPassword {
     my $self = shift;
 
-    unless ( $self->current_userCanModify('Password') ) {
+    unless ( $self->current_user_can_modify('Password') ) {
         return ( 0, $self->loc("Permission Denied") );
     }
     my ( $status, $pass ) = $self->set_RandomPassword();
@@ -910,7 +910,7 @@
     my $self     = shift;
     my $password = shift;
 
-    unless ( $self->current_userCanModify('Password') ) {
+    unless ( $self->current_user_can_modify('Password') ) {
         return ( 0, $self->loc('Password: Permission Denied') );
     }
 
@@ -1212,9 +1212,9 @@
 
 # }}}
 
-# {{{ sub CurrentUserCanModify
+# {{{ sub current_user_can_modify
 
-=head2 CurrentUserCanModify RIGHT
+=head2 current_user_can_modify RIGHT
 
 If the user has rights for this object, either because
 he has 'AdminUsers' or (if he\'s trying to edit himself and the right isn\'t an 
@@ -1222,7 +1222,7 @@
 
 =cut
 
-sub CurrentUserCanModify {
+sub current_user_can_modify {
     my $self  = shift;
     my $right = shift;
 
@@ -1498,7 +1498,7 @@
          ($self->id == $RT::Nobody->id)) {
         return ( 0, $self->loc("Can not modify system users") );
     }
-    unless ( $self->current_userCanModify( $args{'column'} ) ) {
+    unless ( $self->current_user_can_modify( $args{'column'} ) ) {
         return ( 0, $self->loc("Permission Denied") );
     }
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Record.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Record.pm	Sun Sep 30 02:28:03 2007
@@ -280,6 +280,8 @@
 sub create {
     my $self    = shift;
     my %attribs = (@_);
+    if (ref($self) eq 'RT::Model::Queue') {
+    }
     foreach my $key ( keys %attribs ) {
         my $method = $self->can("validate_$key");
         if ($method) { 
@@ -365,7 +367,6 @@
     # We don't want to hang onto this
     delete $self->{'attributes'};
 
-    warn YAML::Dump(\%hash);
     return $self->SUPER::load_by_cols( @_ );# unless $self->_Handle->case_sensitive;
 
     # If this database is case sensitive we need to uncase objects for

Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Notify.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Notify.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Notify.pm	Sun Sep 30 02:28:03 2007
@@ -125,7 +125,6 @@
         }
 
     }
-
     if ( $arg =~ /\bAdminCc\b/ ) {
         push ( @Bcc, $ticket->AdminCc->MemberEmailAddresses  );
         push ( @Bcc, $ticket->QueueObj->AdminCc->MemberEmailAddresses  );
@@ -138,7 +137,7 @@
         }
     }
 
-    my $creator = $self->TransactionObj->CreatorObj->EmailAddress();
+    my $creator = $self->TransactionObj->CreatorObj->EmailAddress() ||'' ;
 
     #Strip the sender out of the To, Cc and AdminCc and set the 
     # recipients fields used to build the message by the superclass.
@@ -149,9 +148,9 @@
         @{ $self->{'Bcc'} } = @Bcc;
     }
     else {
-        @{ $self->{'To'} }  = grep ( lc $_ ne lc $creator, @To );
-        @{ $self->{'Cc'} }  = grep ( lc $_ ne lc $creator, @Cc );
-        @{ $self->{'Bcc'} } = grep ( lc $_ ne lc $creator, @Bcc );
+        @{ $self->{'To'} }  = grep { lc $_ ne lc $creator} @To;
+        @{ $self->{'Cc'} }  = grep { lc $_ ne lc $creator} @Cc;
+        @{ $self->{'Bcc'} } = grep { lc $_ ne lc $creator} @Bcc;
     }
     @{ $self->{'PseudoTo'} } = @PseudoTo;
 


More information about the Rt-commit mailing list