You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2012/11/08 18:13:51 UTC

[9/15] git commit: CIMI: empty collections never have a body

CIMI: empty collections never have a body


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

Branch: refs/heads/master
Commit: ad1157ac766f7cb1ea72b322327077b6a9c61024
Parents: c0e7429
Author: David Lutterkort <lu...@redhat.com>
Authored: Tue Nov 6 17:03:38 2012 -0800
Committer: David Lutterkort <lu...@redhat.com>
Committed: Thu Nov 8 09:11:18 2012 -0800

----------------------------------------------------------------------
 server/lib/cimi/models/collection.rb |    1 -
 server/lib/cimi/models/schema.rb     |    4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ad1157ac/server/lib/cimi/models/collection.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/collection.rb b/server/lib/cimi/models/collection.rb
index 2373359..b099669 100644
--- a/server/lib/cimi/models/collection.rb
+++ b/server/lib/cimi/models/collection.rb
@@ -38,7 +38,6 @@ module CIMI::Model
     # Prepare to serialize
     def prepare
       self.count = self.entries.size
-      self.count = nil if self.count == 0
       if self.class.embedded
         ["id", "href"].each { |a| self[a] = nil if self[a] == "" }
         # Handle href and id, which are really just aliases of one another

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ad1157ac/server/lib/cimi/models/schema.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/schema.rb b/server/lib/cimi/models/schema.rb
index e9504e9..fe4ed07 100644
--- a/server/lib/cimi/models/schema.rb
+++ b/server/lib/cimi/models/schema.rb
@@ -235,7 +235,7 @@ class CIMI::Model::Schema
 
     def to_xml(model, xml)
       model[name].prepare
-      if model[name].count.nil?
+      if model[name].entries.empty?
         xml[xml_name] = { "href" => model[name].href }
       else
         xml[xml_name] = @collection_class.schema.to_xml(model[name])
@@ -244,7 +244,7 @@ class CIMI::Model::Schema
 
     def to_json(model, json)
       model[name].prepare
-      if model[name].count.nil?
+      if model[name].entries.empty?
         json[json_name] = { "href" => model[name].href }
       else
         json[json_name] = @collection_class.schema.to_json(model[name])