NarrativeWeb: Re-verted dump_place() with alternate_locations returned back to original setup.

svn: r15638
This commit is contained in:
Rob G. Healey 2010-07-15 23:25:12 +00:00
parent 3567664f4c
commit 0fdd49ad87

View File

@ -141,9 +141,11 @@ STREET = _("Street")
THEAD = _("Type") THEAD = _("Type")
TEMPLE = _("Temple") TEMPLE = _("Temple")
VHEAD = _("Value") VHEAD = _("Value")
ALTERNATE_LOCATIONS = _("Alternate Locations")
# initialize places latitude/ longitude global variable # initialize global variable
place_lat_long = [] place_lat_long = []
_individuallist = set()
# Events that are usually a family event # Events that are usually a family event
_EVENTMAP = [ gen.lib.EventType.MARRIAGE, gen.lib.EventType.MARR_ALT, _EVENTMAP = [ gen.lib.EventType.MARRIAGE, gen.lib.EventType.MARR_ALT,
@ -182,8 +184,6 @@ wrapper = TextWrapper()
wrapper.break_log_words = True wrapper.break_log_words = True
wrapper.width = 20 wrapper.width = 20
_individuallist = set()
_html_dbl_quotes = re.compile(r'([^"]*) " ([^"]*) " (.*)', re.VERBOSE) _html_dbl_quotes = re.compile(r'([^"]*) " ([^"]*) " (.*)', re.VERBOSE)
_html_sng_quotes = re.compile(r"([^']*) ' ([^']*) ' (.*)", re.VERBOSE) _html_sng_quotes = re.compile(r"([^']*) ' ([^']*) ' (.*)", re.VERBOSE)
_html_replacement = { _html_replacement = {
@ -1873,46 +1873,6 @@ class BasePage(object):
# return hyperlink to its callers # return hyperlink to its callers
return hyper return hyper
def dump_place_locations(self, location, tbody, place = None, alt_loc = False):
"""
dump either main or alternate locations
@param: location -- either main or alternate location
@param: tbody -- table body element
@place -- either None or a place object to get latitude/ longitude
@param: alt_loc -- is this an alternate location?
"""
# begin table row
for (label, data) in [
(STREET, location.street),
(CITY, location.city),
(PARISH, location.parish),
(COUNTY, location.county),
(STATE, location.state),
(POSTAL, location.postal),
(COUNTRY, location.country) ]:
if data:
trow = Html("tr") + (
Html("td", label, class_ = "ColumnAttribute", inline = True),
Html("td", data, class_ = "ColumnValue")
)
tbody += trow
if place:
for (label, data) in [
(LATITUDE, place.lat),
(LONGITUDE, place.long) ]:
if data:
trow = Html("tr") + (
Html("td", label, class_ = "ColumnAttribute", inline = True),
Html("td", data, class_ = "ColumnValue")
)
tbody += trow
# return table body back to its callers
return tbody
def dump_place(self, place, table): def dump_place(self, place, table):
""" """
dump a place's information from within the database dump a place's information from within the database
@ -1935,14 +1895,24 @@ class BasePage(object):
if place.main_loc: if place.main_loc:
ml = place.get_main_location() ml = place.get_main_location()
if ml and not ml.is_empty(): if ml and not ml.is_empty():
self.dump_place_locations(ml, tbody, place)
# add alternate_locations for (label, data) in [
al = place.get_alternate_locations() (STREET, ml.street),
if al: (CITY, ml.city),
for location in al: (PARISH, ml.parish),
if location and not location.is_empty(): (COUNTY, ml.county),
self.dump_place_locations(location, tbody, alt_loc = True) (STATE, ml.state),
(POSTAL, ml.postal),
(COUNTRY, ml.country),
(LATITUDE, place.lat),
(LONGITUDE, place.long),
(ALTERNATE_LOCATIONS, place.get_alternate_locations() ) ]:
if data:
trow = Html("tr") + (
Html("td", label, class_ = "ColumnAttribute", inline = True),
Html("td", data, class_ = "ColumnValue", inline = True)
)
tbody += trow
# return place table to its callers # return place table to its callers
return table return table