Permalink
Browse files

Deprecate @response

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5207 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
jeremy committed Sep 29, 2006
1 parent d7b5b44 commit d15d15b2c236a556f89536961adf2de7f1fd04dc
View
@@ -2,7 +2,7 @@
* assert_select_rjs decodes escaped unicode chars since the Javascript generators encode them. #6240 [japgolly]
-* Deprecation: @cookies, @headers, @request will be removed after 1.2. Use the corresponding method instead. [Jeremy Kemper]
+* Deprecation: @cookies, @headers, @request, @response will be removed after 1.2. Use the corresponding method instead. [Jeremy Kemper]
* Make the :status parameter expand to the default message for that status code if it is an integer. Also support symbol statuses. [Jamis Buck]. Examples:
@@ -304,7 +304,7 @@ class Base
# <tt>response.headers["Cache-Control"] = "no-cache"</tt>. Can also be used to access the final body HTML after a template
# has been rendered through response.body -- useful for <tt>after_filter</tt>s 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 <tt>session[:person]</tt> 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 @@ def initialize_template_class(response)
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 @@ def protected_instance_variables
%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
@@ -125,17 +125,17 @@ def expire_page(options = {})
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 @@ def expire_action(options = {})
end
end
- class ActionCacheFilter #:nodoc:
+ class ActionCacheFilter #:nodoc:
def initialize(*actions, &block)
@actions = actions
end
@@ -126,11 +126,11 @@ def flash_with_components(refresh = false) #: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]
@@ -33,7 +33,7 @@ def cookies
# Deprecated cookie writer method
def cookie(*options)
- @response.headers["cookie"] << CGI::Cookie.new(*options)
+ response.headers['cookie'] << CGI::Cookie.new(*options)
end
end
@@ -250,7 +250,7 @@ def render_with_a_layout(options = nil, deprecated_status = nil, deprecated_layo
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)
@@ -8,7 +8,7 @@
<% if false %>
<br /><br />
<% begin %>
- <%= form_tag(@request.request_uri, "method" => @request.method) %>
+ <%= form_tag(request.request_uri, "method" => request.method) %>
<input type="hidden" name="BP-RETRY" value="1" />
<% 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 @@
<p><b>Parameters</b>: <%=h request_dump == "{}" ? "None" : request_dump %></p>
<p><a href="#" onclick="document.getElementById('session_dump').style.display='block'; return false;">Show session dump</a></p>
-<div id="session_dump" style="display:none"><%= debug(@request.session.instance_variable_get("@data")) %></div>
+<div id="session_dump" style="display:none"><%= debug(request.session.instance_variable_get("@data")) %></div>
<h2 style="margin-top: 30px">Response</h2>
-<b>Headers</b>: <%=h @response.headers.inspect.gsub(/,/, ",\n") %><br/>
+<b>Headers</b>: <%=h response.headers.inspect.gsub(/,/, ",\n") %><br/>
@@ -1,6 +1,6 @@
<h1>
<%=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"] %>
</h1>
<p>
@@ -0,0 +1 @@
+<%= @response.body %>
@@ -0,0 +1 @@
+<%= response.body %>

0 comments on commit d15d15b

Please sign in to comment.