summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2016-11-23 09:45:21 -0500
committerTim Graham <timograham@gmail.com>2016-11-23 09:45:21 -0500
commit2e5fbe889f02c74ab8c153043f22ccce96230716 (patch)
tree7dbc5cd4194b1076a9dc9bc9a3ca34028a5e4f2e
parentb63d0c54b05ede2589e2b720eb0c102c02891962 (diff)
Cleaned up some __getstate__() docstrings.
-rw-r--r--django/db/models/query.py3
-rw-r--r--django/template/response.py8
-rw-r--r--django/utils/functional.py9
3 files changed, 8 insertions, 12 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py
index becdef6c6e..b6449582b2 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -197,9 +197,6 @@ class QuerySet(object):
return obj
def __getstate__(self):
- """
- Allows the QuerySet to be pickled.
- """
# Force the cache to be fully populated.
self._fetch_all()
obj_dict = self.__dict__.copy()
diff --git a/django/template/response.py b/django/template/response.py
index 944a1dcd17..7d6693aee6 100644
--- a/django/template/response.py
+++ b/django/template/response.py
@@ -44,11 +44,9 @@ class SimpleTemplateResponse(HttpResponse):
self._is_rendered = False
def __getstate__(self):
- """Pickling support function.
-
- Ensures that the object can't be pickled before it has been
- rendered, and that the pickled state only includes rendered
- data, not the data used to construct the response.
+ """
+ Raise an exception if trying to pickle an unrendered response. Pickle
+ only rendered data, not the data used to construct the response.
"""
obj_dict = self.__dict__.copy()
if not self._is_rendered:
diff --git a/django/utils/functional.py b/django/utils/functional.py
index c317293bb2..f86271b28d 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -300,11 +300,12 @@ class LazyObject(object):
self._setup()
return (unpickle_lazyobject, (self._wrapped,))
- # We have to explicitly override __getstate__ so that older versions of
- # pickle don't try to pickle the __dict__ (which in the case of a
- # SimpleLazyObject may contain a lambda). The value will end up being
- # ignored by our __reduce__ and custom unpickler.
def __getstate__(self):
+ """
+ Prevent older versions of pickle from trying to pickle the __dict__
+ (which in the case of a SimpleLazyObject may contain a lambda). The
+ value will be ignored by __reduce__() and the custom unpickler.
+ """
return {}
def __copy__(self):