~matsubara/ubuntu/trusty/python-urllib3/bug-1412545

« back to all changes in this revision

Viewing changes to urllib3/filepost.py

  • Committer: Package Import Robot
  • Author(s): Barry Warsaw
  • Date: 2012-11-01 15:31:36 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20121101153136-w2fm02askveqxxkx
Tags: 1.5-0ubuntu1
* New upstream release.  Remaining changes:
  - 01_do-not-use-embedded-python-six.patch: refreshed
  - 02_require-cert-verification.patch: refreshed
  - 03-fix-appenginge.patch: removed

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
import codecs
8
8
import mimetypes
9
9
 
10
 
try:
11
 
    from mimetools import choose_boundary
12
 
except ImportError:
13
 
    from .packages.mimetools_choose_boundary import choose_boundary
14
 
 
 
10
from uuid import uuid4
15
11
from io import BytesIO
16
12
 
17
13
import six
20
16
writer = codecs.lookup('utf-8')[3]
21
17
 
22
18
 
 
19
def choose_boundary():
 
20
    """
 
21
    Our embarassingly-simple replacement for mimetools.choose_boundary.
 
22
    """
 
23
    return uuid4().hex
 
24
 
 
25
 
23
26
def get_content_type(filename):
24
27
    return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
25
28