Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(410)

Issue 179056: Add cache to safe_eval (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 5 months ago by ced1
Modified:
16 years, 5 months ago
Reviewers:
bch, h.goebel
Visibility:
Public.

Patch Set 1 #

Total comments: 1

Patch Set 2 : Use get #

Unified diffs Side-by-side diffs Delta from patch set Stats (+24 lines, -14 lines) Patch
M tryton/common/common.py View 1 1 chunk +24 lines, -14 lines 0 comments Download

Messages

Total messages: 3
ced1
16 years, 5 months ago (2009-12-15 11:03:54 UTC) #1
bch
On 2009/12/15 11:03:54, ced wrote: > OK
16 years, 5 months ago (2009-12-15 11:47:15 UTC) #2
h.goebel
16 years, 5 months ago (2009-12-15 16:34:53 UTC) #3
In addition to the review-comment:

I propose putting save_eval into a module by it's own which can easily be held
consistent between client and server. Seeing non-trivial code duplicated within
a project always makes me shiver.

http://codereview.appspot.com/179056/diff/1/2
File tryton/common/common.py (right):

http://codereview.appspot.com/179056/diff/1/2#newcode1188
tryton/common/common.py:1188: 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.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b