deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [9/15] git commit: CIMI: empty collections never have a body
Date Thu, 08 Nov 2012 17:13:51 GMT
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 <lutter@redhat.com>
Authored: Tue Nov 6 17:03:38 2012 -0800
Committer: David Lutterkort <lutter@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])


Mime
View raw message