diff options
author | Rob Reilink <r.reilink@science-applied.nl> | 2012-03-13 17:55:34 +0100 |
---|---|---|
committer | Rob Reilink <r.reilink@science-applied.nl> | 2012-03-13 17:55:34 +0100 |
commit | 3bc8298406ac2cba6837f7a5d76aa44df3ce3d1f (patch) | |
tree | 05a4b011e5457a7e10694b5db771c1b8e162df02 | |
parent | 3137157ebafefaedad02cfc780957b3adb59e826 (diff) | |
download | sphinx-3bc8298406ac2cba6837f7a5d76aa44df3ce3d1f.tar.gz |
fixed encoding for hashing functions for Python 3
-rw-r--r-- | sphinx/ext/graphviz.py | 4 | ||||
-rw-r--r-- | sphinx/ext/inheritance_diagram.py | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index 9c2012c7..28938140 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -121,9 +121,11 @@ class GraphvizSimple(Directive): def render_dot(self, code, options, format, prefix='graphviz'): """Render graphviz code into a PNG or PDF output file.""" - hashkey = code.encode('utf-8') + str(options) + \ + hashkey = (code + str(options) + \ str(self.builder.config.graphviz_dot) + \ str(self.builder.config.graphviz_dot_args) + ).encode('utf-8') + fname = '%s-%s.%s' % (prefix, sha(hashkey).hexdigest(), format) if hasattr(self.builder, 'imgpath'): # HTML diff --git a/sphinx/ext/inheritance_diagram.py b/sphinx/ext/inheritance_diagram.py index 7dc57ab1..be7a6766 100644 --- a/sphinx/ext/inheritance_diagram.py +++ b/sphinx/ext/inheritance_diagram.py @@ -39,7 +39,7 @@ r""" import re import sys import inspect -import __builtin__ +import __builtin__ as __builtin__ # as __builtin__ is for lib2to3 compatibility try: from hashlib import md5 except ImportError: @@ -314,7 +314,8 @@ class InheritanceDiagram(Directive): def get_graph_hash(node): - return md5(node['content'] + str(node['parts'])).hexdigest()[-10:] + encoded = (node['content'] + str(node['parts'])).encode('utf-8') + return md5(encoded).hexdigest()[-10:] def html_visit_inheritance_diagram(self, node): |