[Python-checkins] cpython: Issue #18978: A more elegant technique for resolving the method
jason.coombs
python-checkins at python.org
Sun Sep 22 16:11:17 CEST 2013
http://hg.python.org/cpython/rev/2b2744cfb08f
changeset: 85782:2b2744cfb08f
user: Jason R. Coombs <jaraco at jaraco.com>
date: Sun Sep 08 12:54:33 2013 -0400
summary:
Issue #18978: A more elegant technique for resolving the method
files:
Lib/urllib/request.py | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -321,12 +321,8 @@
def get_method(self):
"""Return a string indicating the HTTP request method."""
- if getattr(self, 'method', None) is not None:
- return self.method
- elif self.data is not None:
- return "POST"
- else:
- return "GET"
+ default_method = "POST" if self.data is not None else "GET"
+ return getattr(self, 'method', default_method)
def get_full_url(self):
return self.full_url
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list