Skip to content

Commit

Permalink
Merge pull request #295 from RockefellerArchiveCenter/development
Browse files Browse the repository at this point in the history
Allows configuration of location information
  • Loading branch information
helrond authored Jul 5, 2023
2 parents 5e69939 + 17cfe64 commit 7870c51
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions process_request/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,15 @@ def make_short_location(loc_data):
location_list.insert(0, loc_data["building"])
return ".".join(location_list)

def use_full_location(loc_data):
location_list = loc_data.get("title", "").strip()
return location_list

locations = None
if top_container_info.get("container_locations"):
locations = ",".join([make_short_location(c["_resolved"]) for c in top_container_info.get("container_locations")])
if getattr(settings, 'USE_LOCATION_TITLE', False):
locations = ",".join([use_full_location(c["_resolved"]) for c in top_container_info.get("container_locations", [])])
else:
locations = ",".join([make_short_location(c["_resolved"]) for c in top_container_info.get("container_locations", [])])
return locations


Expand Down
1 change: 1 addition & 0 deletions request_broker/config.py.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ DIMES_BASEURL = "${DIMES_BASEURL}"
RESTRICTED_IN_CONTAINER = ${RESTRICTED_IN_CONTAINER}
OFFSITE_BUILDINGS = ${OFFSITE_BUILDINGS}
RESOURCE_ID_SEPARATOR = "${RESOURCE_ID_SEPARATOR}"
USE_LOCATION_TITLE = ${USE_LOCATION_TITLE}
1 change: 1 addition & 0 deletions request_broker/config.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ DIMES_BASEURL = "https://dimes.rockarch.org" # Base URL for DIMES application
RESTRICTED_IN_CONTAINER = False # Fetch a list of restricted items in the same container as the requested item.
OFFSITE_BUILDINGS = ["Armonk", "Greenrock"] # Names of offsite buildings, which will be added to locations (list of strings)
RESOURCE_ID_SEPARATOR = ':'
USE_LOCATION_TITLE = False # Use the title field from a top container location
1 change: 1 addition & 0 deletions request_broker/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,5 @@

RESTRICTED_IN_CONTAINER = config.RESTRICTED_IN_CONTAINER
OFFSITE_BUILDINGS = getattr(config, 'OFFSITE_BUILDINGS', [])
USE_LOCATION_TITLE = config.USE_LOCATION_TITLE
RESOURCE_ID_SEPARATOR = config.RESOURCE_ID_SEPARATOR

0 comments on commit 7870c51

Please sign in to comment.