Skip to content

Commit

Permalink
suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anv3sh committed Sep 14, 2022
1 parent 482b257 commit b009251
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 7 additions & 6 deletions django/core/handlers/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def close(self):


class WSGIRequest(HttpRequest):
wsgi_non_picklable_attrs = frozenset(
non_picklable_attrs = HttpRequest.non_picklable_attrs | frozenset(["environ"])
meta_non_picklable_attrs = frozenset(
[
"wsgi.errors",
"wsgi.input",
Expand Down Expand Up @@ -97,11 +98,11 @@ def __init__(self, environ):
self.resolver_match = None

def __getstate__(self):
obj_dict = self.__dict__.copy()
for attr in self.wsgi_non_picklable_attrs:
if attr in obj_dict["META"]:
del obj_dict["META"][attr]
return super().__getstate__()
state = super().__getstate__()
for attr in self.meta_non_picklable_attrs:
if attr in state["META"]:
del state["META"][attr]
return state

def _get_scheme(self):
return self.environ.get("wsgi.url_scheme")
Expand Down
1 change: 0 additions & 1 deletion django/http/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class HttpRequest:
non_picklable_attrs = frozenset(
[
"resolver_match",
"environ",
"_stream",
]
)
Expand Down

0 comments on commit b009251

Please sign in to comment.