[Jifty-commit] r4608 - in jifty/trunk: lib/Jifty/Plugin/REST

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Dec 3 17:42:54 EST 2007


Author: sterling
Date: Mon Dec  3 17:42:53 2007
New Revision: 4608

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm

Log:
 r14335 at riddle:  andrew | 2007-12-03 16:41:08 -0600
 Fixing HTML dumping so that the HTML is more correct and easier to read when debugging.


Modified: jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm	Mon Dec  3 17:42:53 2007
@@ -378,17 +378,33 @@
 sub html_dump {
     my $content = shift;
     if (ref($content) eq 'ARRAY') {
-        ul(map {
-            li(html_dump($_))
-        } @{$content});
+        if (keys %$content) {
+            return ul(map {
+                li(html_dump($_))
+            } @{$content});
+        }
+        else {
+            return;
+        }
     }
     elsif (ref($content) eq 'HASH') {
-        dl(map {
-            dt(Jifty::Web->escape($_)),
-            dd(html_dump($content->{$_})),
-        } sort keys %{$content}),
+        if (keys %$content) {
+            return dl(map {
+                dt(Jifty::Web->escape($_)),
+                dd(html_dump($content->{$_})),
+            } sort keys %{$content});
+        }
+        else {
+            return;
+        }
+    
     } elsif (ref($content) && $content->isa('Jifty::Collection')) {
-        return  ol( map { li( html_dump_record($_))  } @{$content->items_array_ref});
+        if ($content->count) {
+            return  ol( map { li( html_dump_record($_))  } @{$content->items_array_ref});
+        }
+        else {
+            return;
+        }
         
     } elsif (ref($content) && $content->isa('Jifty::Record')) {
           return   html_dump_record($content);


More information about the Jifty-commit mailing list