On Mar 13, 2012, at 5:17 PM, [email protected] wrote:

ACK. Did the job. Good catch Marios!


  -- Michal

> From: marios <[email protected]>
> 
> HTML views for CIMI are being phased out...
> 
> Signed-off-by: marios <[email protected]>
> ---
> server/lib/sinatra/rack_accept.rb |   10 +++++++---
> 1 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/server/lib/sinatra/rack_accept.rb 
> b/server/lib/sinatra/rack_accept.rb
> index b576307..0f179ea 100644
> --- a/server/lib/sinatra/rack_accept.rb
> +++ b/server/lib/sinatra/rack_accept.rb
> @@ -77,9 +77,13 @@ module Rack
>             self[type] = handler
>           end
>           yield wants
> -          @media_type = accepting_formats.to_a.sort { |a,b| a[1]<=>b[1] 
> }.reverse.select do |format, priority|
> -            wants.keys.include?(format) == true
> -          end.first
> +          if ENV['API_FRONTEND'] == "cimi"
> +            @media_type = (accepting_formats.has_key?(:xml) ? [:xml, 
> accepting_formats[:xml]] : nil)
> +          else
> +            @media_type ||= accepting_formats.to_a.sort { |a,b| a[1]<=>b[1] 
> }.reverse.select do |format, priority|
> +              wants.keys.include?(format) == true
> +            end.first
> +          end
>           if @media_type and @media_type[0]
>             @media_type = @media_type[0]
>             headers 'Content-Type' => 
> Rack::MediaType::ACCEPTED_MEDIA_TYPES[@media_type][:return]
> -- 
> 1.7.6.5
> 

Reply via email to