changeset 5273:87aebcc15dc2

lib: cleanup around use of the random and hash libraries
author Mads Kiilerich <madski@unity3d.com>
date Mon, 20 Jul 2015 15:11:41 +0200
parents 94e8d5425259
children e268da9b748f
files kallithea/lib/auth.py kallithea/lib/helpers.py
diffstat 2 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/auth.py	Mon Jul 20 15:08:08 2015 +0200
+++ b/kallithea/lib/auth.py	Mon Jul 20 15:11:41 2015 +0200
@@ -33,7 +33,6 @@
 import itertools
 import collections
 
-from tempfile import _RandomNameSequence
 from decorator import decorator
 
 from pylons import url, request
--- a/kallithea/lib/helpers.py	Mon Jul 20 15:08:08 2015 +0200
+++ b/kallithea/lib/helpers.py	Mon Jul 20 15:11:41 2015 +0200
@@ -17,7 +17,6 @@
 Consists of functions to typically be used within templates, but also
 available to Controllers. This module is available to both as 'h'.
 """
-import random
 import hashlib
 import StringIO
 import math
@@ -30,7 +29,7 @@
 from pygments import highlight as code_highlight
 from pylons import url
 from pylons.i18n.translation import _, ungettext
-from hashlib import md5
+from hashlib import md5 # used as h.md5
 
 from webhelpers.html import literal, HTML, escape
 from webhelpers.html.tools import *
@@ -130,7 +129,7 @@
     :param path:
     """
 
-    return 'C-%s-%s' % (short_id(raw_id), md5(safe_str(path)).hexdigest()[:12])
+    return 'C-%s-%s' % (short_id(raw_id), hashlib.md5(safe_str(path)).hexdigest()[:12])
 
 
 class _GetError(object):