Show More
@@ -38,8 +38,10 b' import time' | |||||
38 |
|
38 | |||
39 | def code_name(code, number=0): |
|
39 | def code_name(code, number=0): | |
40 | """ Compute a (probably) unique name for code for caching. |
|
40 | """ Compute a (probably) unique name for code for caching. | |
|
41 | ||||
|
42 | This now expects code to be unicode. | |||
41 | """ |
|
43 | """ | |
42 | hash_digest = hashlib.md5(code).hexdigest() |
|
44 | hash_digest = hashlib.md5(code.encode("utf-8")).hexdigest() | |
43 | # Include the number and 12 characters of the hash in the name. It's |
|
45 | # Include the number and 12 characters of the hash in the name. It's | |
44 | # pretty much impossible that in a single session we'll have collisions |
|
46 | # pretty much impossible that in a single session we'll have collisions | |
45 | # even with truncated hashes, and the full one makes tracebacks too long |
|
47 | # even with truncated hashes, and the full one makes tracebacks too long |
General Comments 0
You need to be logged in to leave comments.
Login now