[Rt-commit] rt branch, 4.0/build-more-table-attributes, created. rt-4.0.2-203-gd091f8f

Kevin Falcone falcone at bestpractical.com
Thu Nov 3 16:50:44 EDT 2011


The branch, 4.0/build-more-table-attributes has been created
        at  d091f8f7ab206dc74502195d8dfd417260f9710f (commit)

- Log -----------------------------------------------------------------
commit ec5943dd7ae4d228b802b6340e05d0f3bd326e96
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Nov 3 15:59:16 2011 -0400

    Call _BuildTableAttributes on all of our Record classes
    
    This also involved loading RT::Link.  Without this, you can never call
    _ClassAccessible on them, you have to sometimes call _ClassAccessible
    and sometimes call _CoreAccessible depending on whether or not they were
    in this list.

diff --git a/lib/RT.pm b/lib/RT.pm
index 8d70af1..f276653 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -413,6 +413,7 @@ sub InitClasses {
     require RT::Dashboard;
     require RT::Approval;
     require RT::Lifecycle;
+    require RT::Link;
     require RT::Article;
     require RT::Articles;
     require RT::Class;
@@ -428,6 +429,9 @@ sub InitClasses {
     # in the session, as we deserialize it so we never call constructor
     # of the class, so the list of accessible fields is empty and we die
     # with "Method xxx is not implemented in RT::SomeClass"
+
+    # without this, we also can never call _ClassAccessible, because we
+    # won't have filled RT::Record::_TABLE_ATTR
     $_->_BuildTableAttributes foreach qw(
         RT::Ticket
         RT::Transaction
@@ -446,6 +450,13 @@ sub InitClasses {
         RT::ObjectCustomField
         RT::ObjectCustomFieldValue
         RT::Attribute
+        RT::ACE
+        RT::Link
+        RT::Article
+        RT::Class
+        RT::ObjectClass
+        RT::ObjectTopic
+        RT::Topic
     );
 
     if ( $args{'Heavy'} ) {

commit d091f8f7ab206dc74502195d8dfd417260f9710f
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Nov 3 16:00:22 2011 -0400

    Stop pushing the RHS of _CoreAccessible into the _ClassAccesible result
    
    Before, we used to shove things like int(11) or 4 or 1 or 11 into the
    result set that _ClassAccessible gave back.  We also would try to
    dereference %{ $attributes->{$hashref} } since $column was a hashref
    half of the time.
    
    This cleans up the data significantly.

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index fcc7bed..84e9285 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -664,8 +664,8 @@ sub _BuildTableAttributes {
 
     }
 
-    foreach my $column (%$attributes) {
-        foreach my $attr ( %{ $attributes->{$column} } ) {
+    foreach my $column (keys %$attributes) {
+        foreach my $attr ( keys %{ $attributes->{$column} } ) {
             $_TABLE_ATTR->{$class}->{$column}->{$attr} = $attributes->{$column}->{$attr};
         }
     }
@@ -673,8 +673,8 @@ sub _BuildTableAttributes {
         next unless UNIVERSAL::can( $self, $method );
         $attributes = $self->$method();
 
-        foreach my $column (%$attributes) {
-            foreach my $attr ( %{ $attributes->{$column} } ) {
+        foreach my $column ( keys %$attributes ) {
+            foreach my $attr ( keys %{ $attributes->{$column} } ) {
                 $_TABLE_ATTR->{$class}->{$column}->{$attr} = $attributes->{$column}->{$attr};
             }
         }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list