Merge pull request #762 from Lukasa/develop

Correctly handle encoding numbers when POSTing.
This commit is contained in:
Kenneth Reitz
2012-08-06 14:05:21 -07:00
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -95,6 +95,7 @@ if is_py2:
bytes = str
str = unicode
basestring = basestring
numeric_types = (int, long, float)
@@ -110,4 +111,5 @@ elif is_py3:
str = str
bytes = bytes
basestring = (str,bytes)
numeric_types = (int, float)
+2 -2
View File
@@ -32,7 +32,7 @@ from .utils import (
DEFAULT_CA_BUNDLE_PATH)
from .compat import (
cookielib, urlparse, urlunparse, urljoin, urlsplit, urlencode, str, bytes,
StringIO, is_py2, chardet, json, builtin_str)
StringIO, is_py2, chardet, json, builtin_str, numeric_types)
REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved)
CONTENT_CHUNK_SIZE = 10 * 1024
@@ -356,7 +356,7 @@ class Request(object):
fields.update({k: (fn, fp.read())})
for field in fields:
if isinstance(fields[field], float):
if isinstance(fields[field], numeric_types):
fields[field] = str(fields[field])
if isinstance(fields[field], list):
newvalue = ', '.join(fields[field])