[Pypi-checkins] r773 - trunk/pypi
martin.von.loewis
python-checkins at python.org
Wed Jul 21 00:09:03 CEST 2010
Author: martin.von.loewis
Date: Wed Jul 21 00:09:03 2010
New Revision: 773
Modified:
trunk/pypi/store.py
trunk/pypi/webui.py
Log:
Cleanup imports.
Modified: trunk/pypi/store.py
==============================================================================
--- trunk/pypi/store.py (original)
+++ trunk/pypi/store.py Wed Jul 21 00:09:03 2010
@@ -1,6 +1,6 @@
''' Implements a store of disutils PKG-INFO entries, keyed off name, version.
'''
-import sys, os, re, psycopg2, time, sha, random, types, math, stat, errno
+import sys, os, re, psycopg2, time, hashlib, random, types, math, stat, errno
import logging, cStringIO, string, datetime, calendar, binascii, urllib2, cgi
from xml.parsers import expat
from distutils.version import LooseVersion
@@ -1295,7 +1295,7 @@
if self.has_user(name):
if password:
# update existing user, including password
- password = sha.sha(password).hexdigest()
+ password = hashlib.sha1(password).hexdigest()
safe_execute(cursor,
'update users set password=%s, email=%s where name=%s',
(password, email, name))
@@ -1314,7 +1314,7 @@
if cursor.fetchone()[0] > 0:
raise ValueError, "Email address already belongs to a different user"
- password = sha.sha(password).hexdigest()
+ password = hashlib.sha1(password).hexdigest()
# new user
safe_execute(cursor,
@@ -1943,7 +1943,7 @@
self.userip = userip
def setpasswd(self, username, password):
- password = sha.sha(password).hexdigest()
+ password = hashlib.sha1(password).hexdigest()
self.get_cursor().execute('''
update users set password=%s where name=%s
''', (password, username))
Modified: trunk/pypi/webui.py
==============================================================================
--- trunk/pypi/webui.py (original)
+++ trunk/pypi/webui.py Wed Jul 21 00:09:03 2010
@@ -1,7 +1,7 @@
# system imports
-import sys, os, urllib, cStringIO, traceback, cgi, binascii, getopt, md5
-import time, random, smtplib, base64, sha, email, types, stat, urlparse
-import re, zipfile, logging, pprint, sets, shutil, Cookie, subprocess
+import sys, os, urllib, cStringIO, traceback, cgi, binascii
+import time, random, smtplib, base64, email, types, urlparse
+import re, zipfile, logging, shutil, Cookie, subprocess, hashlib
from zope.pagetemplate.pagetemplatefile import PageTemplateFile
from distutils.util import rfc822_escape
from distutils2.metadata import DistributionMetadata
@@ -14,7 +14,7 @@
from xml.etree import cElementTree
# local imports
-import store, config, trove, versionpredicate, verify_filetype, rpc
+import store, config, versionpredicate, verify_filetype, rpc
import MailingLogger, openid2rp
from mini_pkg_resources import safe_name
@@ -433,7 +433,7 @@
# Invalid base64, or not exactly one colon
un = pw = ''
if self.store.has_user(un):
- pw = sha.sha(pw).hexdigest()
+ pw = hashlib.sha1(pw).hexdigest()
user = self.store.get_user(un)
if pw != user['password']:
raise Unauthorised, 'Incorrect password'
@@ -989,7 +989,7 @@
write_element(pelem, person, 'foaf:name')
email = info[person+'_email']
if email and email != 'UNKNOWN':
- obj = sha.new(email)
+ obj = hashlib.sha1(email)
email = binascii.b2a_hex(obj.digest())
elem = SE(pelem, 'foaf:mbox_sha1sum')
elem.text = email
@@ -1326,7 +1326,7 @@
self.write_template('index.pt', title="Index of Packages",
matches=l)
- STOPWORDS = sets.Set([
+ STOPWORDS = set([
"a", "and", "are", "as", "at", "be", "but", "by",
"for", "if", "in", "into", "is", "it",
"no", "not", "of", "on", "or", "such",
@@ -2218,7 +2218,7 @@
raise FormError, "signature is not ASCII-armored"
# digest content
- m = md5.new()
+ m = hashlib.md5()
m.update(content)
calc_digest = m.hexdigest()
@@ -2228,7 +2228,7 @@
self.fail(heading='MD5 digest mismatch',
message='''The MD5 digest supplied does not match a
digest calculated from the uploaded file (m =
- md5.new(); m.update(content); digest =
+ hashlib.md5(); m.update(content); digest =
m.hexdigest())''')
return
More information about the Pypi-checkins
mailing list