deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 3/9] CIMI: Apply $filter and $select in Base#list
Date Fri, 01 Mar 2013 13:32:23 GMT
From: Michal Fojtik <mfojtik@redhat.com>

No need to have ugly chained methods in collections.

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/cimi/collections/machines.rb | 2 +-
 server/lib/cimi/service/base.rb         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/lib/cimi/collections/machines.rb b/server/lib/cimi/collections/machines.rb
index 0337f86..f3cb62a 100644
--- a/server/lib/cimi/collections/machines.rb
+++ b/server/lib/cimi/collections/machines.rb
@@ -24,7 +24,7 @@ module CIMI::Collections
       operation :index, :with_capability => :instances do
         description "List all machines"
         control do
-          machines = Machine.list(self).select_by(params['$select']).filter_by(params['$filter'])
+          machines = Machine.list(self)
           respond_to do |format|
             format.xml { machines.to_xml }
             format.json { machines.to_json }
diff --git a/server/lib/cimi/service/base.rb b/server/lib/cimi/service/base.rb
index 9c281b7..9f2c765 100644
--- a/server/lib/cimi/service/base.rb
+++ b/server/lib/cimi/service/base.rb
@@ -97,7 +97,7 @@ module CIMI::Service
       params = {}
       params[:desc] = "#{self.name.split("::").last} Collection for the #{ctx.driver.name.capitalize}
driver"
       params[:add_url] = create_url(ctx)
-      model_class.list(id, entries, params)
+      model_class.list(id, entries, params).select_by(ctx.params['$select']).filter_by(ctx.params['$filter'])
     end
 
     def self.create_url(ctx)
-- 
1.8.1.2


Mime
View raw message