http://codereview.appspot.com/178050/diff/1003/5 File trytond/tools/misc.py (right): http://codereview.appspot.com/178050/diff/1003/5#newcode523 trytond/tools/misc.py:523: if hashlib: Since you are implementing a cache to ...
16 years, 5 months ago
(2009-12-15 16:24:32 UTC)
#5
http://codereview.appspot.com/178050/diff/1003/5
File trytond/tools/misc.py (right):
http://codereview.appspot.com/178050/diff/1003/5#newcode523
trytond/tools/misc.py:523: if hashlib:
Since you are implementing a cache to gain speed, I suggest removing this
if-statement:
# change import section above like this:
try:
import hashlib
MD5 = hashlib.md5
except ImportError:
import md5
MD5 = md5.new
#change this if-statement into
key = MD5(source).digest()
Additionally, I see no need for an hexdigest here, so we can use a normals
digest, which cheaper.
Issue 178050: Add cache to safe_eval
(Closed)
Created 16 years, 5 months ago by ced1
Modified 16 years, 5 months ago
Reviewers: bch, yangoon1, h.goebel
Base URL:
Comments: 1