Merged revisions 73435 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73435 | tarek.ziade | 2009-06-16 01:04:29 +0200 (Tue, 16 Jun 2009) | 1 line

  code cleanup
........
This commit is contained in:
Tarek Ziadé 2009-06-28 21:10:49 +00:00
parent 5a55b61a2a
commit 6f6f9462b0
1 changed files with 7 additions and 12 deletions

View File

@ -1,11 +1,6 @@
"""distutils.command.upload """distutils.command.upload
Implements the Distutils 'upload' subcommand (upload package to PyPI).""" Implements the Distutils 'upload' subcommand (upload package to PyPI)."""
from distutils.errors import *
from distutils.core import PyPIRCCommand
from distutils.spawn import spawn
from distutils import log
import sys import sys
import os, io import os, io
import socket import socket
@ -14,12 +9,12 @@ import configparser
import http.client as httpclient import http.client as httpclient
import base64 import base64
import urllib.parse import urllib.parse
from hashlib import md5
# this keeps compatibility for 2.3 and 2.4 from distutils.errors import *
if sys.version < "2.5": from distutils.core import PyPIRCCommand
from md5 import md5 from distutils.spawn import spawn
else: from distutils import log
from hashlib import md5
class upload(PyPIRCCommand): class upload(PyPIRCCommand):
@ -137,10 +132,10 @@ class upload(PyPIRCCommand):
for key, value in data.items(): for key, value in data.items():
title = '\nContent-Disposition: form-data; name="%s"' % key title = '\nContent-Disposition: form-data; name="%s"' % key
# handle multiple entries for the same name # handle multiple entries for the same name
if type(value) != type([]): if not isinstance(value, list):
value = [value] value = [value]
for value in value: for value in value:
if type(value) is tuple: if isinstance(value, tuple):
title += '; filename="%s"' % value[0] title += '; filename="%s"' % value[0]
value = value[1] value = value[1]
else: else: