Converted Date, Name, and NameType to gen.lib.object so that libaccess can be used instead.

svn: r14977
This commit is contained in:
Rob G. Healey 2010-03-31 02:45:39 +00:00
parent 6b1c15db54
commit 433033f6b8

View File

@ -68,8 +68,7 @@ log = logging.getLogger(".WebPage")
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from gen.ggettext import sgettext as _ from gen.ggettext import sgettext as _
import gen.lib import gen.lib
from gen.lib import UrlType, date, Date, \ from gen.lib import UrlType, date, FamilyRelType
FamilyRelType, NameType, Name
import const import const
import Sort import Sort
from gen.plug.menu import PersonOption, NumberOption, StringOption, \ from gen.plug.menu import PersonOption, NumberOption, StringOption, \
@ -792,18 +791,18 @@ class BasePage(object):
married_name = None married_name = None
names = [primary_name] + person.get_alternate_names() names = [primary_name] + person.get_alternate_names()
for name in names: for name in names:
if int(name.get_type()) == NameType.MARRIED: if int(name.get_type()) == gen.lib.NameType.MARRIED:
married_name = name married_name = name
break # use first break # use first
# Now, decide which to use: # Now, decide which to use:
if maiden_name is not None: if maiden_name is not None:
if married_name is not None: if married_name is not None:
name = Name(married_name) name = gen.lib.Name(married_name)
else: else:
name = Name(primary_name) name = gen.lib.Name(primary_name)
name.set_surname(maiden_name) name.set_surname(maiden_name)
else: else:
name = Name(primary_name) name = gen.lib.Name(primary_name)
name.set_display_as(name_format) name.set_display_as(name_format)
return _nd.display_name(name) return _nd.display_name(name)
@ -2384,7 +2383,7 @@ class EventListPage(BasePage):
# event date # event date
tcell = Html("td", class_ = "ColumnDate", inline = True) tcell = Html("td", class_ = "ColumnDate", inline = True)
trow += tcell trow += tcell
if date and date is not Date.EMPTY: if date and date is not gen.lib.Date.EMPTY:
tcell += _dd.display(date) tcell += _dd.display(date)
else: else:
tcell += " " tcell += " "
@ -2788,7 +2787,7 @@ class MediaPage(BasePage):
# media date # media date
date = media.get_date_object() date = media.get_date_object()
if date and date is not Date.EMPTY: if date and date is not gen.lib.Date.EMPTY:
trow = Html("tr") + ( trow = Html("tr") + (
Html("td", DHEAD, class_ = "ColumnAttribute", inline = True), Html("td", DHEAD, class_ = "ColumnAttribute", inline = True),
Html("td", _dd.display(date), class_ = "ColumnValue", inline = True) Html("td", _dd.display(date), class_ = "ColumnValue", inline = True)
@ -3994,14 +3993,14 @@ class IndividualPage(BasePage):
table += trow table += trow
# Age At Death??? # Age At Death???
birth_date = Date.EMPTY birth_date = gen.lib.Date.EMPTY
birth_ref = self.person.get_birth_ref() birth_ref = self.person.get_birth_ref()
if birth_ref: if birth_ref:
birth = db.get_event_from_handle(birth_ref.ref) birth = db.get_event_from_handle(birth_ref.ref)
if birth: if birth:
birth_date = birth.get_date_object() birth_date = birth.get_date_object()
if birth_date and birth_date is not Date.EMPTY: if birth_date and birth_date is not gen.lib.Date.EMPTY:
alive = Utils.probably_alive(self.person, db, date.Today() ) alive = Utils.probably_alive(self.person, db, date.Today() )
death_date = _find_death_date(db, self.person) death_date = _find_death_date(db, self.person)
@ -6221,7 +6220,7 @@ def add_birthdate(db, childlist):
if birth: if birth:
birth_date = birth.get_date_object() birth_date = birth.get_date_object()
else: else:
birth_date = Date(2199, 12, 31) birth_date = gen.lib.Date(2199, 12, 31)
sorted_children.append((birth_date, child_handle)) sorted_children.append((birth_date, child_handle))
# return the list of child handles and their birthdates # return the list of child handles and their birthdates