Skip to content

Commit

Permalink
[Fixes #11316] external pyCSW Service breaks upload of Documents and …
Browse files Browse the repository at this point in the history
…Datasets (#11319)

Co-authored-by: Alessio Fabiani <alessio.fabiani@geosolutionsgroup.com>
  • Loading branch information
mwallschlaeger and afabiani authored Aug 23, 2023
1 parent 49cef44 commit 029a0bf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions geonode/catalogue/backends/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,13 @@ def get_by_uuid(self, uuid):
return None
record = list(self.records.values())[0]
record.keywords = []
if hasattr(record, "identification") and hasattr(record.identification[0], "keywords"):
if (
hasattr(record, "identification")
and len(record.identification) > 0
and hasattr(record.identification[0], "keywords")
):
for kw in record.identification[0].keywords:
record.keywords.extend(kw["keywords"])
record.keywords.extend(kw.keywords)
return record
else:
return None
Expand All @@ -111,7 +115,6 @@ def url_for_uuid(self, uuid, outputschema):

def urls_for_uuid(self, uuid):
"""returns list of valid GetRecordById URLs for a given record"""

urls = []
for mformat in self.formats:
urls.append(("text/xml", mformat, self.url_for_uuid(uuid, METADATA_FORMATS[mformat][1])))
Expand All @@ -124,6 +127,7 @@ def csw_gen_xml(self, layer, template):
site_url = settings.SITEURL.rstrip("/") if settings.SITEURL.startswith("http") else settings.SITEURL
tpl = get_template(template)
ctx = {
"CATALOG_METADATA_TEMPLATE": settings.CATALOG_METADATA_TEMPLATE,
"layer": layer,
"SITEURL": site_url,
"id_pname": id_pname,
Expand Down

0 comments on commit 029a0bf

Please sign in to comment.