summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/template/response.py12
-rw-r--r--tests/regressiontests/templates/response.py7
2 files changed, 3 insertions, 16 deletions
diff --git a/django/template/response.py b/django/template/response.py
index 990a17b6bf..bb0b9cbf9d 100644
--- a/django/template/response.py
+++ b/django/template/response.py
@@ -6,10 +6,6 @@ class ContentNotRenderedError(Exception):
pass
-class DiscardedAttributeError(AttributeError):
- pass
-
-
class SimpleTemplateResponse(HttpResponse):
rendering_attrs = ['template_name', 'context_data', '_post_render_callbacks']
@@ -36,7 +32,6 @@ class SimpleTemplateResponse(HttpResponse):
# True, so we initialize it to False after the call to super __init__.
self._is_rendered = False
-
def __getstate__(self):
"""Pickling support function.
@@ -54,13 +49,6 @@ class SimpleTemplateResponse(HttpResponse):
return obj_dict
- def __getattr__(self, name):
- if name in self.rendering_attrs:
- raise DiscardedAttributeError('The %s attribute was discarded '
- 'when this %s class was pickled.' %
- (name, self.__class__.__name__))
- return super(SimpleTemplateResponse, self).__getattr__(name)
-
def resolve_template(self, template):
"Accepts a template object, path-to-template or list of paths"
if isinstance(template, (list, tuple)):
diff --git a/tests/regressiontests/templates/response.py b/tests/regressiontests/templates/response.py
index 0e067405ad..f7bcb60f1b 100644
--- a/tests/regressiontests/templates/response.py
+++ b/tests/regressiontests/templates/response.py
@@ -9,8 +9,7 @@ from django.conf import settings
import django.template.context
from django.template import Template, Context
from django.template.response import (TemplateResponse, SimpleTemplateResponse,
- ContentNotRenderedError,
- DiscardedAttributeError)
+ ContentNotRenderedError)
def test_processor(request):
return {'processors': 'yes'}
@@ -198,7 +197,7 @@ class SimpleTemplateResponseTest(BaseTemplateResponseTest):
# ...and requesting any of those attributes raises an exception
for attr in template_attrs:
- with self.assertRaises(DiscardedAttributeError) as cm:
+ with self.assertRaises(AttributeError):
getattr(unpickled_response, attr)
def test_repickling(self):
@@ -282,7 +281,7 @@ class TemplateResponseTest(BaseTemplateResponseTest):
# ...and requesting any of those attributes raises an exception
for attr in template_attrs:
- with self.assertRaises(DiscardedAttributeError) as cm:
+ with self.assertRaises(AttributeError):
getattr(unpickled_response, attr)
def test_repickling(self):