From d15d15b2c236a556f89536961adf2de7f1fd04dc Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 29 Sep 2006 08:26:45 +0000 Subject: Deprecate @response git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5207 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/base.rb | 19 ++++++++++--------- actionpack/lib/action_controller/caching.rb | 8 ++++---- actionpack/lib/action_controller/components.rb | 6 +++--- actionpack/lib/action_controller/cookies.rb | 2 +- actionpack/lib/action_controller/layout.rb | 2 +- .../templates/rescues/_request_and_response.rhtml | 8 ++++---- .../templates/rescues/template_error.rhtml | 2 +- 7 files changed, 24 insertions(+), 23 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 5e5eab586c..a4b3a7314a 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -304,7 +304,7 @@ module ActionController #:nodoc: # response.headers["Cache-Control"] = "no-cache". Can also be used to access the final body HTML after a template # has been rendered through response.body -- useful for after_filters that wants to manipulate the output, # such as a OutputCompressionFilter. - attr_accessor :response + attr_internal :response # Holds a hash of objects in the session. Accessed like session[:person] to get the object tied to the "person" # key. The session will hold any type of object as values, but the key should be a string or symbol. @@ -1016,14 +1016,14 @@ module ActionController #:nodoc: def assign_shortcuts(request, response) @_request, @_params, @_cookies = request, request.parameters, request.cookies - @response = response - @response.session = request.session + @_response = response + @_response.session = request.session - @_session = @response.session - @template = @response.template - @assigns = @response.template.assigns + @_session = @_response.session + @template = @_response.template + @assigns = @_response.template.assigns - @_headers = @response.headers + @_headers = @_response.headers assign_deprecated_shortcuts(request, response) end @@ -1128,8 +1128,9 @@ module ActionController #:nodoc: %w(@assigns @performed_redirect @performed_render) else %w(@assigns @performed_redirect @performed_render - @_request @request @response @_params @params @_session @session - @_cookies @cookies @template @request_origin @parent_controller) + @_request @request @_response @response @_params @params + @_session @session @_cookies @cookies + @template @request_origin @parent_controller) end end diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index 491d7d7d0c..e7782d3e22 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -125,17 +125,17 @@ module ActionController #:nodoc: end end - # Manually cache the +content+ in the key determined by +options+. If no content is provided, the contents of @response.body is used + # Manually cache the +content+ in the key determined by +options+. If no content is provided, the contents of response.body is used # If no options are provided, the current +options+ for this action is used. Example: # cache_page "I'm the cached content", :controller => "lists", :action => "show" def cache_page(content = nil, options = {}) return unless perform_caching && caching_allowed - self.class.cache_page(content || @response.body, url_for(options.merge({ :only_path => true, :skip_relative_url_root => true }))) + self.class.cache_page(content || response.body, url_for(options.merge({ :only_path => true, :skip_relative_url_root => true }))) end private def caching_allowed - !@request.post? && @response.headers['Status'] && @response.headers['Status'].to_i < 400 + !@request.post? && response.headers['Status'] && response.headers['Status'].to_i < 400 end end @@ -184,7 +184,7 @@ module ActionController #:nodoc: end end - class ActionCacheFilter #:nodoc: + class ActionCacheFilter #:nodoc: def initialize(*actions, &block) @actions = actions end diff --git a/actionpack/lib/action_controller/components.rb b/actionpack/lib/action_controller/components.rb index 0515461910..a7f5be2e6a 100644 --- a/actionpack/lib/action_controller/components.rb +++ b/actionpack/lib/action_controller/components.rb @@ -126,11 +126,11 @@ module ActionController #:nodoc: def component_response(options, reuse_response) klass = component_class(options) request = request_for_component(klass.controller_name, options) - response = reuse_response ? @response : @response.dup + new_response = reuse_response ? response : response.dup - klass.process_with_components(request, response, self) + klass.process_with_components(request, new_response, self) end - + # determine the controller class for the component request def component_class(options) if controller = options[:controller] diff --git a/actionpack/lib/action_controller/cookies.rb b/actionpack/lib/action_controller/cookies.rb index 67086a09cb..52423aa61b 100644 --- a/actionpack/lib/action_controller/cookies.rb +++ b/actionpack/lib/action_controller/cookies.rb @@ -33,7 +33,7 @@ module ActionController #:nodoc: # Deprecated cookie writer method def cookie(*options) - @response.headers["cookie"] << CGI::Cookie.new(*options) + response.headers['cookie'] << CGI::Cookie.new(*options) end end diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb index 338d5980ab..f6d687bd10 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -250,7 +250,7 @@ module ActionController #:nodoc: erase_render_results add_variables_to_assigns @template.instance_variable_set("@content_for_layout", content_for_layout) - @response.layout = layout + response.layout = layout render_text(@template.render_file(layout, true), deprecated_status) else render_with_no_layout(options, deprecated_status, &block) diff --git a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml index 82007ff5e6..d949ffc837 100644 --- a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml +++ b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml @@ -8,7 +8,7 @@ <% if false %>

<% begin %> - <%= form_tag(@request.request_uri, "method" => @request.method) %> + <%= form_tag(request.request_uri, "method" => request.method) %> <% for key, values in params %> @@ -26,7 +26,7 @@ <% end %> <% - request_parameters_without_action = @request.parameters.clone + request_parameters_without_action = request.parameters.clone request_parameters_without_action.delete("action") request_parameters_without_action.delete("controller") @@ -37,8 +37,8 @@

Parameters: <%=h request_dump == "{}" ? "None" : request_dump %>

Show session dump

- +

Response

-Headers: <%=h @response.headers.inspect.gsub(/,/, ",\n") %>
+Headers: <%=h response.headers.inspect.gsub(/,/, ",\n") %>
diff --git a/actionpack/lib/action_controller/templates/rescues/template_error.rhtml b/actionpack/lib/action_controller/templates/rescues/template_error.rhtml index 2cf812cd5f..827d66467d 100644 --- a/actionpack/lib/action_controller/templates/rescues/template_error.rhtml +++ b/actionpack/lib/action_controller/templates/rescues/template_error.rhtml @@ -1,6 +1,6 @@

<%=h @exception.original_exception.class.to_s %> in - <%=h @request.parameters["controller"].capitalize if @request.parameters["controller"]%>#<%=h @request.parameters["action"] %> + <%=h request.parameters["controller"].capitalize if request.parameters["controller"]%>#<%=h request.parameters["action"] %>

-- cgit v1.2.3