GrampsLocale: Fix 'Foo has no attribute _Foo__get_type' execption

From moving the set_locale function to the superclass. One can get
carried away with enforcing private attributes...

svn: r22062
This commit is contained in:
John Ralls 2013-04-21 17:49:08 +00:00
parent 143dcc08fa
commit 5db0763970
4 changed files with 16 additions and 15 deletions

View File

@ -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):

View File

@ -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):

View File

@ -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(),

View File

@ -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(),