[Python-checkins] cpython: Issue #18978: Allow Request.method to be defined at the class level.
jason.coombs
python-checkins at python.org
Sun Sep 22 16:11:16 CEST 2013
http://hg.python.org/cpython/rev/6d6d68c068ad
changeset: 85781:6d6d68c068ad
parent: 85624:aea58e1cae75
user: Jason R. Coombs <jaraco at jaraco.com>
date: Sun Sep 08 12:47:07 2013 -0400
summary:
Issue #18978: Allow Request.method to be defined at the class level.
files:
Lib/urllib/request.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -271,7 +271,8 @@
origin_req_host = request_host(self)
self.origin_req_host = origin_req_host
self.unverifiable = unverifiable
- self.method = method
+ if method:
+ self.method = method
@property
def full_url(self):
@@ -320,7 +321,7 @@
def get_method(self):
"""Return a string indicating the HTTP request method."""
- if self.method is not None:
+ if getattr(self, 'method', None) is not None:
return self.method
elif self.data is not None:
return "POST"
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list