deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 6/7] Core: Consolidated Rack::Accept loading
Date Mon, 10 Sep 2012 09:35:24 GMT
From: Michal Fojtik <mfojtik@redhat.com>

Added all necesary middleware to Rack::Accept 'self.registred' method. Now all
requires for the 'respond_to' method are loaded when 'register Rack::RespondTo'
is called.

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/cimi/helpers.rb        |    2 +-
 server/lib/cimi/server.rb         |    2 --
 server/lib/deltacloud/helpers.rb  |    1 -
 server/lib/deltacloud/server.rb   |    2 --
 server/lib/sinatra/rack_accept.rb |    3 +++
 5 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/server/lib/cimi/helpers.rb b/server/lib/cimi/helpers.rb
index bf268f8..8e81a4a 100644
--- a/server/lib/cimi/helpers.rb
+++ b/server/lib/cimi/helpers.rb
@@ -51,10 +51,10 @@ module CIMI::Collections
     helpers Deltacloud::Helpers::Drivers
     helpers Sinatra::AuthHelper
     helpers Sinatra::UrlForHelper
-    helpers Rack::RespondTo::Helpers
     helpers Deltacloud::Helpers::Application
     helpers CIMIHelper
 
+    helpers Rack::RespondTo::Helpers
     register Rack::RespondTo
 
     enable :xhtml
diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb
index cbb6486..88fc5d0 100644
--- a/server/lib/cimi/server.rb
+++ b/server/lib/cimi/server.rb
@@ -36,8 +36,6 @@ module CIMI
     use Rack::ETag
     use Rack::MatrixParams
     use Rack::DriverSelect
-    use Rack::Accept
-    use Rack::MediaType
 
     helpers CIMIHelper
 
diff --git a/server/lib/deltacloud/helpers.rb b/server/lib/deltacloud/helpers.rb
index 872c239..c065e64 100644
--- a/server/lib/deltacloud/helpers.rb
+++ b/server/lib/deltacloud/helpers.rb
@@ -30,7 +30,6 @@ module Deltacloud::Collections
     helpers Deltacloud::Helpers::Drivers
     helpers Sinatra::AuthHelper
     helpers Sinatra::UrlForHelper
-    helpers Rack::RespondTo::Helpers
     helpers Deltacloud::Helpers::Application
 
     register Rack::RespondTo
diff --git a/server/lib/deltacloud/server.rb b/server/lib/deltacloud/server.rb
index fcd24d9..c7c6c41 100644
--- a/server/lib/deltacloud/server.rb
+++ b/server/lib/deltacloud/server.rb
@@ -37,8 +37,6 @@ module Deltacloud
     use Rack::Date
     use Rack::ETag
     use Rack::DriverSelect
-    use Rack::Accept
-    use Rack::MediaType
 
     include Deltacloud::Helpers
     include Deltacloud::Collections
diff --git a/server/lib/sinatra/rack_accept.rb b/server/lib/sinatra/rack_accept.rb
index 6b77fa8..2ac42ce 100644
--- a/server/lib/sinatra/rack_accept.rb
+++ b/server/lib/sinatra/rack_accept.rb
@@ -23,6 +23,9 @@ module Rack
     # We need to overide the default render method to supply correct path to the
     # template, since Sinatra is by default looking in the current __FILE__ path
     def self.registered(app)
+      app.use Rack::Accept
+      app.use Rack::MediaType
+      app.helpers Rack::RespondTo::Helpers
       app.class_eval do
         alias :render_without_format :render
         def render(*args, &block)
-- 
1.7.10.2


Mime
View raw message