deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [2/65] git commit: Core: Fixed 'render_cdata' helper to die properly when string is nil
Date Fri, 20 Jul 2012 09:59:21 GMT
Core: Fixed 'render_cdata' helper to die properly when string is nil


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/946a1f22
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/946a1f22
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/946a1f22

Branch: refs/heads/master
Commit: 946a1f225d27ad8cedda7eda26ee9848c7f489fe
Parents: dcd627e
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Jul 19 14:58:48 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Fri Jul 20 11:59:09 2012 +0200

----------------------------------------------------------------------
 server/lib/deltacloud/helpers/deltacloud_helper.rb |    2 +-
 server/tests/deltacloud/deltacloud_helper_test.rb  |    1 +
 server/views/blobs/show.xml.haml                   |    3 +--
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/946a1f22/server/lib/deltacloud/helpers/deltacloud_helper.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/helpers/deltacloud_helper.rb b/server/lib/deltacloud/helpers/deltacloud_helper.rb
index 047e1b2..799478e 100644
--- a/server/lib/deltacloud/helpers/deltacloud_helper.rb
+++ b/server/lib/deltacloud/helpers/deltacloud_helper.rb
@@ -152,7 +152,7 @@ module Deltacloud::Helpers
     end
 
     def render_cdata(text)
-      "<![CDATA[#{text.strip}]]>"
+      "<![CDATA[#{text.strip}]]>" unless text.nil?
     end
 
     def link_to_action(action, url, method)

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/946a1f22/server/tests/deltacloud/deltacloud_helper_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/deltacloud_helper_test.rb b/server/tests/deltacloud/deltacloud_helper_test.rb
index 67d4af6..9096db0 100644
--- a/server/tests/deltacloud/deltacloud_helper_test.rb
+++ b/server/tests/deltacloud/deltacloud_helper_test.rb
@@ -42,6 +42,7 @@ describe Deltacloud::Helpers::Application do
     @helper.render_cdata('test').must_equal '<![CDATA[test]]>'
     @helper.render_cdata('').must_equal '<![CDATA[]]>'
     @helper.render_cdata('test   ').must_equal '<![CDATA[test]]>'
+    @helper.render_cdata(nil).must_be_nil
   end
 
   it 'provide helper to access driver entrypoints' do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/946a1f22/server/views/blobs/show.xml.haml
----------------------------------------------------------------------
diff --git a/server/views/blobs/show.xml.haml b/server/views/blobs/show.xml.haml
index 79bb8e6..4687720 100644
--- a/server/views/blobs/show.xml.haml
+++ b/server/views/blobs/show.xml.haml
@@ -9,6 +9,5 @@
   %user_metadata
     - if @blob.user_metadata.respond_to? :each
       - @blob.user_metadata.each do |k, v|
-        %entry{:key => k}
-          #{cdata v}
+        %entry{:key => k}=render_cdata(v)
   %content{:href => bucket_url(@blob.bucket) + '/' + @blob.id + '/content', :rel =>
'blob_content'}


Mime
View raw message