6256: Can't create graph reports

svn: r21011
This commit is contained in:
Benny Malengier 2013-01-06 21:35:34 +00:00
parent 5f24c8834c
commit 642f837658
2 changed files with 9 additions and 4 deletions

View File

@ -598,7 +598,10 @@ class GVDotDoc(GVDocBase):
if self._filename[-3:] != ".gv": if self._filename[-3:] != ".gv":
self._filename += ".gv" self._filename += ".gv"
if sys.version_info[0] < 3:
dotfile = open(self._filename, "w") dotfile = open(self._filename, "w")
else:
dotfile = open(self._filename, "wb")
dotfile.write(self._dot.getvalue()) dotfile.write(self._dot.getvalue())
dotfile.close() dotfile.close()

View File

@ -47,6 +47,7 @@ from functools import partial
# GRAMPS modules # GRAMPS modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from gramps.gen.constfunc import conv_to_unicode
from gramps.gen.plug.menu import (BooleanOption, EnumeratedListOption, FilterOption, from gramps.gen.plug.menu import (BooleanOption, EnumeratedListOption, FilterOption,
PersonOption, ColorOption) PersonOption, ColorOption)
from gramps.gen.plug.report import Report from gramps.gen.plug.report import Report
@ -172,7 +173,8 @@ class RelGraphReport(Report):
children children
""" """
# Hash people in a dictionary for faster inclusion checking # 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: for person_handle in self.person_handles:
person = self.database.get_person_from_handle(person_handle) person = self.database.get_person_from_handle(person_handle)
@ -182,7 +184,7 @@ class RelGraphReport(Report):
father_handle = family.get_father_handle() father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
for child_ref in family.get_child_ref_list(): 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 frel = child_ref.frel
mrel = child_ref.mrel mrel = child_ref.mrel
break break
@ -241,7 +243,7 @@ class RelGraphReport(Report):
(shape, style, color, fill) = self.get_gender_style(person) (shape, style, color, fill) = self.get_gender_style(person)
url = "" url = ""
if self.includeurl: if self.includeurl:
h = person_handle h = conv_to_unicode(person_handle, 'utf-8')
dirpath = "ppl/%s/%s" % (h[-1], h[-2]) dirpath = "ppl/%s/%s" % (h[-1], h[-2])
dirpath = dirpath.lower() dirpath = dirpath.lower()
url = "%s/%s.html" % (dirpath, h) url = "%s/%s.html" % (dirpath, h)