Skip to content

Commit

Permalink
Resolves #2 rndt: catalogue template file moved as settings configura…
Browse files Browse the repository at this point in the history
…tion (#6894)

Co-authored-by: Giovanni Allegri <giohappy@gmail.com>
Co-authored-by: Alessio Fabiani <alessio.fabiani@geo-solutions.it>
  • Loading branch information
3 people authored Jan 30, 2021
1 parent d712fe9 commit d722888
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion geonode/catalogue/metadataxsl/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def prefix_xsl_line(req, id):
if resource.metadata_uploaded and resource.metadata_uploaded_preserve:
md_doc = etree.tostring(dlxml.fromstring(resource.metadata_xml))
else:
md_doc = catalogue.catalogue.csw_gen_xml(resource, 'catalogue/full_metadata.xml')
md_doc = catalogue.catalogue.csw_gen_xml(resource, settings.CATALOG_METADATA_TEMPLATE)
xml = md_doc
except Exception:
logger.debug(traceback.format_exc())
Expand Down
2 changes: 1 addition & 1 deletion geonode/catalogue/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def catalogue_post_save(instance, sender, **kwargs):
if instance.metadata_uploaded and instance.metadata_uploaded_preserve:
md_doc = etree.tostring(dlxml.fromstring(instance.metadata_xml))
else:
md_doc = catalogue.catalogue.csw_gen_xml(instance, 'catalogue/full_metadata.xml')
md_doc = catalogue.catalogue.csw_gen_xml(instance, settings.CATALOG_METADATA_TEMPLATE)
try:
csw_anytext = catalogue.catalogue.csw_gen_anytext(md_doc)
except Exception as e:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" ?>
<csw:Transaction service="CSW" version="2.0.2" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-publication.xsd">
<csw:Insert>
{% include "catalogue/full_metadata.xml" %}
{% include CATALOG_METADATA_TEMPLATE %}
</csw:Insert>
</csw:Transaction>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<csw:Transaction service="CSW" version="2.0.2" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-publication.xsd">
<csw:Update>
{% include "catalogue/full_metadata.xml" %}
{% include CATALOG_METADATA_TEMPLATE %}
</csw:Update>
</csw:Transaction>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<csw:Transaction service="CSW" version="2.0.2" xmlns:dc="http://www.purl.org/dc/elements/1.1/" xmlns:ogc="http://www.opengis.net/ogc" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-publication.xsd">
<csw:Update>
{% include "catalogue/full_metadata.xml" %}
{% include CATALOG_METADATA_TEMPLATE %}
<csw:Constraint version="1.1.0">
<ogc:Filter>
<ogc:PropertyIsEqualTo>
Expand Down
2 changes: 1 addition & 1 deletion geonode/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,6 @@ def resource_urls(request):
GEONODE_APPS_ENABLE=getattr(settings, 'GEONODE_APPS_ENABLE', False),
GEONODE_APPS_NAME=getattr(settings, 'GEONODE_APPS_NAME', 'Apps'),
GEONODE_APPS_NAV_MENU_ENABLE=getattr(settings, 'GEONODE_APPS_NAV_MENU_ENABLE', False),
CATALOG_METADATA_TEMPLATE=getattr(settings, "CATALOG_METADATA_TEMPLATE", "catalogue/full_metadata.xml")
)

return defaults
1 change: 1 addition & 0 deletions geonode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2127,3 +2127,4 @@ def get_geonode_catalogue_service():
SEARCH_RESOURCES_EXTENDED = strtobool(os.getenv('SEARCH_RESOURCES_EXTENDED', 'True'))
# -- END Settings for MONITORING plugin

CATALOG_METADATA_TEMPLATE = os.getenv("CATALOG_METADATA_TEMPLATE", "catalogue/full_metadata.xml")

0 comments on commit d722888

Please sign in to comment.