From 83fdd19efeee709f164a128cc6c0b23ba47beec0 Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Sun, 6 Jan 2013 21:35:45 +0000 Subject: [PATCH] 6256: Can't create graph reports svn: r21012 --- gramps/gen/plug/docgen/graphdoc.py | 5 ++++- gramps/plugins/graph/gvrelgraph.py | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gramps/gen/plug/docgen/graphdoc.py b/gramps/gen/plug/docgen/graphdoc.py index 06ae900c8..bca8cbfed 100644 --- a/gramps/gen/plug/docgen/graphdoc.py +++ b/gramps/gen/plug/docgen/graphdoc.py @@ -598,7 +598,10 @@ class GVDotDoc(GVDocBase): if self._filename[-3:] != ".gv": self._filename += ".gv" - dotfile = open(self._filename, "w") + if sys.version_info[0] < 3: + dotfile = open(self._filename, "w") + else: + dotfile = open(self._filename, "wb") dotfile.write(self._dot.getvalue()) dotfile.close() diff --git a/gramps/plugins/graph/gvrelgraph.py b/gramps/plugins/graph/gvrelgraph.py index 259c79261..9958ca76e 100644 --- a/gramps/plugins/graph/gvrelgraph.py +++ b/gramps/plugins/graph/gvrelgraph.py @@ -47,6 +47,7 @@ from functools import partial # GRAMPS modules # #------------------------------------------------------------------------ +from gramps.gen.constfunc import conv_to_unicode from gramps.gen.plug.menu import (BooleanOption, EnumeratedListOption, FilterOption, PersonOption, ColorOption) from gramps.gen.plug.report import Report @@ -172,7 +173,8 @@ class RelGraphReport(Report): children """ # Hash people in a dictionary for faster inclusion checking - person_dict = dict([handle, 1] for handle in self.person_handles) + person_dict = dict([conv_to_unicode(handle, 'utf-8'), 1] + for handle in self.person_handles) for person_handle in self.person_handles: person = self.database.get_person_from_handle(person_handle) @@ -182,7 +184,7 @@ class RelGraphReport(Report): father_handle = family.get_father_handle() mother_handle = family.get_mother_handle() for child_ref in family.get_child_ref_list(): - if child_ref.ref == person_handle: + if child_ref.ref == conv_to_unicode(person_handle, 'utf-8'): frel = child_ref.frel mrel = child_ref.mrel break @@ -241,7 +243,7 @@ class RelGraphReport(Report): (shape, style, color, fill) = self.get_gender_style(person) url = "" if self.includeurl: - h = person_handle + h = conv_to_unicode(person_handle, 'utf-8') dirpath = "ppl/%s/%s" % (h[-1], h[-2]) dirpath = dirpath.lower() url = "%s/%s.html" % (dirpath, h)