[Rt-commit] r18580 - in rt/3.999/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Tue Feb 24 22:06:07 EST 2009


Author: sartak
Date: Tue Feb 24 22:06:07 2009
New Revision: 18580

Modified:
   rt/3.999/trunk/   (props changed)
   rt/3.999/trunk/share/html/Elements/CollectionAsTable/Row

Log:
 r80553 at onn:  sartak | 2009-02-24 22:06:03 -0500
 Handle stringification-overloaded objects coming out of the ColumnMap


Modified: rt/3.999/trunk/share/html/Elements/CollectionAsTable/Row
==============================================================================
--- rt/3.999/trunk/share/html/Elements/CollectionAsTable/Row	(original)
+++ rt/3.999/trunk/share/html/Elements/CollectionAsTable/Row	Tue Feb 24 22:06:07 2009
@@ -122,9 +122,21 @@
             # All HTML snippets are returned by the callback function
             # as scalar references.  Data fetched from the objects are
             # plain scalars, and needs to be escaped properly.
-            push @out, grep defined && length,
-                map { ref($_) ? $$_ : $m->interp->apply_escapes( $_ => 'h' ) }
-                $value->( $record, $i );
+            for my $out ($value->($record, $i)) {
+                # Objects with stringification overload should be treated as
+                # regular strings.
+                $out = "$out" if overload::Method($out, q{""});
+
+                if (ref($out)) {
+                    $out = $$out
+                }
+                else {
+                    $out = $m->interp->apply_escapes($out => 'h');
+                }
+
+                push @out, $out if defined($out) && length($out);
+            }
+
         } elsif ( defined $value && length $value ) {
 
             # Simple value; just escape it.


More information about the Rt-commit mailing list