Skip to content

Commit

Permalink
Add encode before hasing key source with unit test pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
tushuhei committed Sep 29, 2016
1 parent 76cfb2a commit 7a5e44d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions budou/budou.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ def parse(self, source, classname=DEFAULT_CLASS_NAME, use_cache=True):

def _get_cache_key(self, source, classname):
"""Returns a cache key for the given source and class name."""
key_source = '%s:%s:%s' % (
CACHE_SALT, source.encode('utf8'), classname.encode('utf8'))
return hashlib.md5(key_source.encode()).hexdigest()
key_source = u'%s:%s:%s' % (CACHE_SALT, source, classname)
return hashlib.md5(key_source.encode('utf8')).hexdigest()


def _get_annotations(self, text, encoding='UTF32'):
Expand Down

0 comments on commit 7a5e44d

Please sign in to comment.