NarrativeWeb: Changed the way that place.alternate_locations are displayed.
svn: r15635
This commit is contained in:
@ -1880,6 +1880,45 @@ class BasePage(object):
|
|||||||
# return hyperlink to its callers
|
# return hyperlink to its callers
|
||||||
return hyper
|
return hyper
|
||||||
|
|
||||||
|
def dump_place_locations(self, location, place = None):
|
||||||
|
"""
|
||||||
|
dump either main or alternate locations
|
||||||
|
|
||||||
|
@param: location -- either main or alternate location
|
||||||
|
@param: trow -- table row elements
|
||||||
|
@place -- either None or a place object
|
||||||
|
"""
|
||||||
|
if not location or not location.is_empty():
|
||||||
|
return
|
||||||
|
|
||||||
|
# begin table row
|
||||||
|
trow = Html("tr")
|
||||||
|
|
||||||
|
# begin table row
|
||||||
|
place_location_fields = (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 place:
|
||||||
|
place_location_fields += [
|
||||||
|
(LATITUDE, place.lat),
|
||||||
|
(LONGITUDE, place.long) ]
|
||||||
|
|
||||||
|
trow.extend(
|
||||||
|
(Html("td", label, class_ = "ColumnAttribute", inline = True) +
|
||||||
|
Html("td", data, class_ = "ColumnValue") )
|
||||||
|
for (label, data) in place_location_fields
|
||||||
|
if data
|
||||||
|
)
|
||||||
|
|
||||||
|
# return table row back to its callers
|
||||||
|
return trow
|
||||||
|
|
||||||
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
|
||||||
@ -1904,25 +1943,16 @@ 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():
|
tbody.extend(
|
||||||
for (label, data) in [
|
self.dump_place_locations(ml, place)
|
||||||
(STREET, ml.street),
|
)
|
||||||
(CITY, ml.city),
|
|
||||||
(PARISH, ml.parish),
|
# add alternate_locations if they exist
|
||||||
(COUNTY, ml.county),
|
alt_loc = place.get_alternate_locations()
|
||||||
(STATE, ml.state),
|
for location in alt_loc:
|
||||||
(POSTAL, ml.postal),
|
tbody.extend(
|
||||||
(COUNTRY, ml.country),
|
self.dump_place_locations(location)
|
||||||
(LOCATIONS, place.get_alternate_locations() ),
|
|
||||||
(LATITUDE, place.lat),
|
|
||||||
(LONGITUDE, place.long) ]:
|
|
||||||
|
|
||||||
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
|
||||||
|
Reference in New Issue
Block a user