[r22062]GrampsLocale: Fix execption
'Foo has no attribute _Foo__get_type' From moving the set_locale function to the superclass. One can get carried away with enforcing private attributes... svn: r22063
This commit is contained in:
parent
f405ef9f3a
commit
f9e8c90b7d
@ -65,8 +65,8 @@ class Report(object):
|
||||
language = None
|
||||
locale = GrampsLocale(lang=language)
|
||||
self._ = locale.translation.gettext
|
||||
self.__get_date = locale.get_date
|
||||
self.__get_type = locale.get_type
|
||||
self._get_date = locale.get_date
|
||||
self._get_type = locale.get_type
|
||||
return locale
|
||||
|
||||
def write_report(self):
|
||||
|
@ -946,6 +946,7 @@ class GrampsLocale(object):
|
||||
:returns: The name as text in the proper language.
|
||||
:rtype: unicode
|
||||
"""
|
||||
from gramps.gen.lib.grampstype import GrampsType
|
||||
return GrampsType.xml_str(name)
|
||||
|
||||
def format(self, format, val, grouping=False, monetary=False):
|
||||
|
@ -326,7 +326,7 @@ class DetAncestorReport(Report):
|
||||
self.doc.end_paragraph()
|
||||
first = False
|
||||
self.doc.start_paragraph('DAR-MoreDetails')
|
||||
atype = self.__get_type(alt_name.get_type())
|
||||
atype = self._get_type(alt_name.get_type())
|
||||
self.doc.write_text_citation(
|
||||
self._('%(name_kind)s: %(name)s%(endnotes)s') % {
|
||||
'name_kind' : self._(atype),
|
||||
@ -366,7 +366,7 @@ class DetAncestorReport(Report):
|
||||
self.doc.write_text(self._('Address: '))
|
||||
|
||||
if self.fulldate:
|
||||
date = self.__get_date(addr.get_date_object())
|
||||
date = self._get_date(addr.get_date_object())
|
||||
else:
|
||||
date = addr.get_date_object().get_year()
|
||||
|
||||
@ -387,7 +387,7 @@ class DetAncestorReport(Report):
|
||||
|
||||
for attr in attrs:
|
||||
self.doc.start_paragraph('DAR-MoreDetails')
|
||||
attrName = self.__get_type(attr.get_type())
|
||||
attrName = self._get_type(attr.get_type())
|
||||
text = self._("%(type)s: %(value)s%(endnotes)s") % {
|
||||
'type' : self._(attrName),
|
||||
'value' : attr.get_value(),
|
||||
@ -402,7 +402,7 @@ class DetAncestorReport(Report):
|
||||
event = self.database.get_event_from_handle(event_ref.ref)
|
||||
|
||||
if self.fulldate:
|
||||
date = self.__get_date(event.get_date_object())
|
||||
date = self._get_date(event.get_date_object())
|
||||
else:
|
||||
date = event.get_date_object().get_year()
|
||||
|
||||
@ -413,7 +413,7 @@ class DetAncestorReport(Report):
|
||||
place = ''
|
||||
|
||||
self.doc.start_paragraph('DAR-MoreDetails')
|
||||
evtName = self.__get_type(event.get_type())
|
||||
evtName = self._get_type(event.get_type())
|
||||
if date and place:
|
||||
text += self._('%(date)s, %(place)s') % {
|
||||
'date' : date, 'place' : place }
|
||||
@ -445,7 +445,7 @@ class DetAncestorReport(Report):
|
||||
for attr in attr_list:
|
||||
if text:
|
||||
text += "; "
|
||||
attrName = self.__get_type(attr.get_type())
|
||||
attrName = self._get_type(attr.get_type())
|
||||
text += self._("%(type)s: %(value)s%(endnotes)s") % {
|
||||
'type' : self._(attrName),
|
||||
'value' : attr.get_value(),
|
||||
|
@ -418,7 +418,7 @@ class DetDescendantReport(Report):
|
||||
event = self.database.get_event_from_handle(event_ref.ref)
|
||||
|
||||
if self.fulldate:
|
||||
date = self.__get_date(event.get_date_object())
|
||||
date = self._get_date(event.get_date_object())
|
||||
else:
|
||||
date = event.get_date_object().get_year()
|
||||
|
||||
@ -429,7 +429,7 @@ class DetDescendantReport(Report):
|
||||
place = ''
|
||||
|
||||
self.doc.start_paragraph('DDR-MoreDetails')
|
||||
event_name = self.__get_type(event.get_type())
|
||||
event_name = self._get_type(event.get_type())
|
||||
if date and place:
|
||||
text += self._('%(date)s, %(place)s') % {
|
||||
'date' : date, 'place' : place }
|
||||
@ -461,7 +461,7 @@ class DetDescendantReport(Report):
|
||||
for attr in attr_list:
|
||||
if text:
|
||||
text += "; "
|
||||
attrName = self.__get_type(attr.get_type())
|
||||
attrName = self._get_type(attr.get_type())
|
||||
text += self._("%(type)s: %(value)s%(endnotes)s") % {
|
||||
'type' : self._(attrName),
|
||||
'value' : attr.get_value(),
|
||||
@ -708,7 +708,7 @@ class DetDescendantReport(Report):
|
||||
|
||||
for attr in attrs:
|
||||
self.doc.start_paragraph('DDR-MoreDetails')
|
||||
attrName = self.__get_type(attr.get_type())
|
||||
attrName = self._get_type(attr.get_type())
|
||||
text = self._("%(type)s: %(value)s%(endnotes)s") % {
|
||||
'type' : self._(attrName),
|
||||
'value' : attr.get_value(),
|
||||
@ -787,7 +787,7 @@ class DetDescendantReport(Report):
|
||||
self.doc.end_paragraph()
|
||||
first = False
|
||||
self.doc.start_paragraph('DDR-MoreDetails')
|
||||
atype = self.__get_type(alt_name.get_type())
|
||||
atype = self._get_type(alt_name.get_type())
|
||||
aname = alt_name.get_regular_name()
|
||||
self.doc.write_text_citation(self._('%(name_kind)s: %(name)s%(endnotes)s') % {
|
||||
'name_kind' : self._(atype),
|
||||
@ -820,7 +820,7 @@ class DetDescendantReport(Report):
|
||||
text = ReportUtils.get_address_str(addr)
|
||||
|
||||
if self.fulldate:
|
||||
date = self.__get_date(addr.get_date_object())
|
||||
date = self._get_date(addr.get_date_object())
|
||||
else:
|
||||
date = addr.get_date_object().get_year()
|
||||
|
||||
@ -842,7 +842,7 @@ class DetDescendantReport(Report):
|
||||
|
||||
for attr in attrs:
|
||||
self.doc.start_paragraph('DDR-MoreDetails')
|
||||
attrName = self.__get_type(attr.get_type())
|
||||
attrName = self._get_type(attr.get_type())
|
||||
text = self._("%(type)s: %(value)s%(endnotes)s") % {
|
||||
'type' : self._(attrName),
|
||||
'value' : attr.get_value(),
|
||||
|
Loading…
Reference in New Issue
Block a user