Skip to content

Commit ef63e9e

Browse files
authored
take care of private surnames and placenames
1 parent 8742dcf commit ef63e9e

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

lxml/lxmlGramplet.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from gramps.gen.lib import date
4343
import gramps.gen.datehandler
4444
from gramps.gen.const import USER_HOME, USER_PLUGINS
45+
from gramps.gen.config import config
4546
from gramps.gui.display import display_url
4647
from gramps.gui.dialog import ErrorDialog
4748
from gramps.plugins.lib.libhtml import Html, xml_lang
@@ -366,6 +367,8 @@ def ParseXML(self, tree, filename):
366367

367368
surname_tag = etree.SubElement(root, NAMESPACE + 'surname')
368369
pname_tag = etree.SubElement(root, NAMESPACE + 'pname')
370+
private_surname = config.get('preferences.private-surname-text')
371+
private_record = config.get('preferences.private-record-text')
369372

370373
# variable
371374

@@ -409,6 +412,13 @@ def ParseXML(self, tree, filename):
409412
else:
410413
mediapath = ''
411414

415+
# privacy
416+
417+
if two.get('priv'): # XML: optional
418+
text = private_record
419+
else:
420+
text = ""
421+
412422
# search ptitle and time log
413423

414424
for three in two.iter():
@@ -422,11 +432,13 @@ def ParseXML(self, tree, filename):
422432
(tag, items) = three.tag, three.items()
423433

424434
if three.tag == NAMESPACE + 'ptitle':
425-
text = str(three.text)
435+
if text != private_record:
436+
text = str(three.text)
426437
if text not in places:
427438
places.append(text) # temp display
428439
if three.tag == NAMESPACE + 'pname':
429-
text = str(three.attrib.get('value'))
440+
if text != private_record:
441+
text = str(three.attrib.get('value'))
430442
translation = str(three.attrib.get('lang'))
431443
if translation == 'None':
432444
translation = xml_lang()[0:2]
@@ -450,7 +462,10 @@ def ParseXML(self, tree, filename):
450462
# with namespace ...
451463

452464
if four.tag == NAMESPACE + 'surname' and four.text != None:
453-
surnames.append(four.text)
465+
if text != private_record:
466+
surnames.append(four.text)
467+
else:
468+
surnames.append(private_surname)
454469

455470
LOG.info('end of loops')
456471

0 commit comments

Comments
 (0)