~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/_urllib2_wrappers.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-09-29 08:49:52 UTC
  • mfrom: (3741.2.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20080929084952-3d81d63rru8tt8mm
(vila) Fix python-2.6 various compatibility issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
# ensure that.
48
48
 
49
49
import httplib
50
 
import md5
51
 
import sha
52
50
import socket
53
51
import urllib
54
52
import urllib2
62
60
    config,
63
61
    debug,
64
62
    errors,
 
63
    osutils,
65
64
    trace,
66
65
    transport,
67
66
    ui,
1123
1122
    H = None
1124
1123
    KD = None
1125
1124
    if algorithm == 'MD5':
1126
 
        H = lambda x: md5.new(x).hexdigest()
 
1125
        H = lambda x: osutils.md5(x).hexdigest()
1127
1126
    elif algorithm == 'SHA':
1128
 
        H = lambda x: sha.new(x).hexdigest()
 
1127
        H = lambda x: osutils.sha(x).hexdigest()
1129
1128
    if H is not None:
1130
1129
        KD = lambda secret, data: H("%s:%s" % (secret, data))
1131
1130
    return H, KD
1134
1133
def get_new_cnonce(nonce, nonce_count):
1135
1134
    raw = '%s:%d:%s:%s' % (nonce, nonce_count, time.ctime(),
1136
1135
                           urllib2.randombytes(8))
1137
 
    return sha.new(raw).hexdigest()[:16]
 
1136
    return osutils.sha(raw).hexdigest()[:16]
1138
1137
 
1139
1138
 
1140
1139
class DigestAuthHandler(AbstractAuthHandler):