[Jifty-commit] r2041 - in jifty/trunk: . lib/Jifty/Plugin/REST t/TestApp-Plugin-REST/t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Oct 19 23:15:54 EDT 2006


Author: jesse
Date: Thu Oct 19 23:15:53 2006
New Revision: 2041

Added:
   jifty/trunk/lib/Jifty/Plugin/REST/
   jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm
      - copied, changed from r2040, /jifty/trunk/plugins/REST/lib/Jifty/Plugin/REST/Dispatcher.pm
Removed:
   jifty/trunk/plugins/REST/lib/Jifty/Plugin/REST/Dispatcher.pm
Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/META.yml
   jifty/trunk/t/TestApp-Plugin-REST/t/00-model-User.t
   jifty/trunk/t/TestApp-Plugin-REST/t/00-prototype.t
   jifty/trunk/t/TestApp-Plugin-REST/t/01-config.t
   jifty/trunk/t/TestApp-Plugin-REST/t/02-basic-use.t

Log:
 r28965 at pinglin:  jesse | 2006-10-19 23:15:53 -0400
 more haxxoring


Modified: jifty/trunk/META.yml
==============================================================================
--- jifty/trunk/META.yml	(original)
+++ jifty/trunk/META.yml	Thu Oct 19 23:15:53 2006
@@ -73,6 +73,7 @@
   Locale::Maketext::Lexicon: 0.60
   Log::Log4perl: 0
   MIME::Types: 0
+  Module:::CoreList: 0
   Module::Pluggable: 2.95
   Module::ScanDeps: 0
   Object::Declare: 0.13

Copied: jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm (from r2040, /jifty/trunk/plugins/REST/lib/Jifty/Plugin/REST/Dispatcher.pm)
==============================================================================
--- /jifty/trunk/plugins/REST/lib/Jifty/Plugin/REST/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm	Thu Oct 19 23:15:53 2006
@@ -1,7 +1,5 @@
 use strict;
 use warnings;
-no warnings 'utf8';
-no warnings 'once';
 
 package Jifty::Plugin::REST::Dispatcher;
 use CGI qw( start_html end_html ul li a dl dt dd );
@@ -11,7 +9,7 @@
 use Data::Dumper ();
 use XML::Simple;
 
-before qr{^ (/=/ .*) \. (js|json|yml|yaml|perl|pl) $}x => run {
+before qr{^ (/=/ .*) \. (js|json|yml|yaml|perl|xml|pl) $}x => run {
     $ENV{HTTP_ACCEPT} = $2;
     dispatch $1;
 };
@@ -67,7 +65,7 @@
         $apache->send_http_header;
         print Data::Dumper::Dumper(@_);
     }
-    elsif ($accept =~ /xml/i) {
+    elsif ($accept =~  qr|^(text/)?xml$|i) {
         $apache->header_out('Content-Type' => 'text/xml; charset=UTF-8');
         $apache->send_http_header;
         print  render_as_xml(@_);
@@ -83,15 +81,19 @@
     last_rule;
 }
 
-sub render_as_html {
+our $xml_config = { SuppressEmpty => '',
+                    NoAttr => 1 };
+
+sub render_as_xml {
     my $content = shift;
+
     if (ref($content) eq 'ARRAY') {
-        return XMLout({$content});
+        return XMLout({value => $content}, %$xml_config);
     }
     elsif (ref($content) eq 'HASH') {
-        return XMLout($content);
+        return XMLout($content, %$xml_config);
     } else {
-        return XMLout({$content})
+        return XMLout({$content}, %$xml_config)
     }
 }
 
@@ -165,7 +167,7 @@
 
 sub list_model_columns {
     my ($model) = model($1);
-    outs(['model', $model], { map { $_->name => { %$_ } } $model->new->columns });
+    outs(['model', $model], { map { $_->name => { %$_ } } sort { $a->sort_order <=> $b->sort_order}  $model->new->columns });
 }
 
 sub list_model_items {

Modified: jifty/trunk/t/TestApp-Plugin-REST/t/00-model-User.t
==============================================================================
--- jifty/trunk/t/TestApp-Plugin-REST/t/00-model-User.t	(original)
+++ jifty/trunk/t/TestApp-Plugin-REST/t/00-model-User.t	Thu Oct 19 23:15:53 2006
@@ -8,7 +8,6 @@
 
 =cut
 
-use lib 'plugins/REST/lib';
 
 use lib 't/lib';
 use Jifty::SubTest;

Modified: jifty/trunk/t/TestApp-Plugin-REST/t/00-prototype.t
==============================================================================
--- jifty/trunk/t/TestApp-Plugin-REST/t/00-prototype.t	(original)
+++ jifty/trunk/t/TestApp-Plugin-REST/t/00-prototype.t	Thu Oct 19 23:15:53 2006
@@ -9,7 +9,6 @@
 
 =cut
 
-use lib 'plugins/REST/lib';
 use lib 't/lib';
 use Jifty::SubTest;
 

Modified: jifty/trunk/t/TestApp-Plugin-REST/t/01-config.t
==============================================================================
--- jifty/trunk/t/TestApp-Plugin-REST/t/01-config.t	(original)
+++ jifty/trunk/t/TestApp-Plugin-REST/t/01-config.t	Thu Oct 19 23:15:53 2006
@@ -2,7 +2,6 @@
 use strict;
 use warnings;
 
-use lib 'plugins/REST/lib';
 
 #use Jifty::Test tests => 3;
 use Jifty::Test tests => 1;

Modified: jifty/trunk/t/TestApp-Plugin-REST/t/02-basic-use.t
==============================================================================
--- jifty/trunk/t/TestApp-Plugin-REST/t/02-basic-use.t	(original)
+++ jifty/trunk/t/TestApp-Plugin-REST/t/02-basic-use.t	Thu Oct 19 23:15:53 2006
@@ -9,7 +9,6 @@
 
 =cut
 
-use lib 'plugins/REST/lib';
 
 use lib 't/lib';
 use Jifty::SubTest;


More information about the Jifty-commit mailing list