From 3477cee63fa0faca4a4be452d71c3d46215786f2 Mon Sep 17 00:00:00 2001
From: Bjoern Pedersen <bjoern.pedersen@frm2.tum.de>
Date: Mon, 20 Aug 2012 14:00:39 +0200
Subject: [PATCH] [REF] Do not use deprecated md5/sha modules
* use hashlib instead of the deprecated modules
---
indico/MaKaC/export/oai2.py | 4 ++--
indico/MaKaC/services/interface/rpc/description.py | 4 ++--
indico/MaKaC/webinterface/session/base.py | 4 ++--
3 Dateien geÀndert, 6 Zeilen hinzugefÌgt(+), 6 Zeilen entfernt(-)
diff --git a/indico/MaKaC/export/oai2.py b/indico/MaKaC/export/oai2.py
index 4700d48..59658be 100644
a
|
b
|
import string |
28 | 28 | from string import split |
29 | 29 | import re |
30 | 30 | import time |
31 | | import md5 |
| 31 | import hashlib |
32 | 32 | from datetime import datetime |
33 | 33 | from pytz import timezone |
34 | 34 | |
… |
… |
class OAIResponse: |
1310 | 1310 | def OAIGenResumptionToken(self): |
1311 | 1311 | "Generates unique ID for resumption token management." |
1312 | 1312 | |
1313 | | return md5.new(str(time.time())).hexdigest() |
| 1313 | return hashlib.md5(str(time.time())).hexdigest() |
1314 | 1314 | |
1315 | 1315 | |
1316 | 1316 | def OAICacheIn(self, resumptionToken, sysnos): |
diff --git a/indico/MaKaC/services/interface/rpc/description.py b/indico/MaKaC/services/interface/rpc/description.py
index 443c8ed..d7ce973 100644
a
|
b
|
|
1 | 1 | from MaKaC.common import Config |
2 | 2 | |
3 | | import sha |
| 3 | import hashlib |
4 | 4 | |
5 | 5 | def fetchClasses(module, namespace): |
6 | 6 | table = {} |
… |
… |
def describe(params, remoteHost, session): |
52 | 52 | from MaKaC.services.interface.rpc import handlers |
53 | 53 | |
54 | 54 | # a unique identifier for the service |
55 | | shaObj = sha.new(Config.getInstance().getBaseURL()) |
| 55 | shaObj = hashlib.sha1(Config.getInstance().getBaseURL()) |
56 | 56 | jsonRpcServiceId = shaObj.hexdigest() |
57 | 57 | # endpoint |
58 | 58 | jsonRpcServiceURL = Config.getInstance().getBaseURL() + '/services/json-rpc/' |
diff --git a/indico/MaKaC/webinterface/session/base.py b/indico/MaKaC/webinterface/session/base.py
index b403f88..304a022 100644
a
|
b
|
try: |
111 | 111 | |
112 | 112 | except IOError: |
113 | 113 | # this is much less secure than the above function |
114 | | import sha |
115 | | _randstate = sha.new(str(time() + clock())) |
| 114 | import hashlib |
| 115 | _randstate = hashlib.sha1(str(time() + clock())) |
116 | 116 | def randlong(bytes): |
117 | 117 | """Return bits of random data as a long integer.""" |
118 | 118 | global _randstate |