Skip to content

Commit 8856297

Browse files
authored
[Fixies #12540] PyCSW upgrade to version 3 (#13112)
1 parent a90b110 commit 8856297

10 files changed

+118
-86
lines changed

geonode/catalogue/backends/pycsw_local.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@
5252
"pretty_print": "true",
5353
"domainquerytype": "range",
5454
"domaincounts": "true",
55-
"profiles": "apiso,ebrim",
5655
},
56+
"profiles": {"apiso", "ebrim"},
5757
"repository": {
5858
"source": "geonode.catalogue.backends.pycsw_plugin.GeoNodeRepository",
5959
"filter": "uuid IS NOT NULL",
6060
"mappings": os.path.join(os.path.dirname(__file__), "pycsw_local_mappings.py"),
6161
},
62+
"logging": {"level": "ERROR"},
6263
}
6364

6465

geonode/catalogue/backends/pycsw_local_mappings.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,29 @@
2828
"pycsw:MdSource": "csw_mdsource",
2929
"pycsw:InsertDate": "csw_insert_date",
3030
"pycsw:XML": "metadata_xml",
31+
"pycsw:Metadata": "metadata",
32+
"pycsw:MetadataType": "metadata_type",
3133
"pycsw:AnyText": "csw_anytext",
3234
"pycsw:Language": "language",
3335
"pycsw:Title": "title",
3436
"pycsw:Abstract": "raw_abstract",
37+
"pycsw:Edition": "edition",
3538
"pycsw:Keywords": "keyword_csv",
3639
"pycsw:KeywordType": "keywordstype",
40+
"pycsw:Themes": "csw_themes",
3741
"pycsw:Format": "spatial_representation_type_string",
3842
"pycsw:Source": "source",
3943
"pycsw:Date": "date",
4044
"pycsw:Modified": "date",
4145
"pycsw:Type": "csw_type",
4246
"pycsw:BoundingBox": "csw_wkt_geometry",
47+
"pycsw:VertExtentMin": "csw_vert_extent_min",
48+
"pycsw:VertExtentMax": "csw_vert_extent_max",
4349
"pycsw:CRS": "csw_crs",
4450
"pycsw:AlternateTitle": "alternate",
4551
"pycsw:RevisionDate": "date",
4652
"pycsw:CreationDate": "date",
4753
"pycsw:PublicationDate": "date",
48-
"pycsw:Organization": "organizationname",
4954
"pycsw:OrganizationName": "organizationname",
5055
"pycsw:SecurityConstraints": "securityconstraints",
5156
"pycsw:ParentIdentifier": "parentidentifier",
@@ -78,6 +83,12 @@
7883
"pycsw:Publisher": "publisher",
7984
"pycsw:Contributor": "contributor",
8085
"pycsw:Relation": "relation",
86+
"pycsw:Platform": "platform",
87+
"pycsw:Instrument": "instrument",
88+
"pycsw:SensorType": "sensortype",
89+
"pycsw:CloudCover": "cloudcover",
90+
"pycsw:Bands": "bands",
8191
"pycsw:Links": "download_links",
92+
"pycsw:Contacts": "contacts",
8293
},
8394
}

geonode/catalogue/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_given_a_request_for_multiple_dataset_should_return_multiple_value_in_xm
111111
request = self.__request_factory_multiple()
112112
response = csw_global_dispatch(request, self.dataset_filter_multiple)
113113
root = ET.fromstring(response.content)
114-
actual = root.find("{http://www.opengis.net/cat/csw/2.0.2}SearchResults").attrib["numberOfRecordsReturned"]
114+
actual = root.find("{http://www.opengis.net/cat/csw/2.0.2}SearchResults").attrib["numberOfRecordsMatched"]
115115
self.assertEqual(2, int(actual))
116116

117117
@staticmethod

geonode/catalogue/views.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ def opensearch_dispatch(request):
164164
"""OpenSearch wrapper"""
165165

166166
ctx = {
167-
"shortname": settings.PYCSW["CONFIGURATION"]["metadata:main"]["identification_title"],
168-
"description": settings.PYCSW["CONFIGURATION"]["metadata:main"]["identification_abstract"],
169-
"developer": settings.PYCSW["CONFIGURATION"]["metadata:main"]["contact_name"],
170-
"contact": settings.PYCSW["CONFIGURATION"]["metadata:main"]["contact_email"],
171-
"attribution": settings.PYCSW["CONFIGURATION"]["metadata:main"]["provider_name"],
172-
"tags": settings.PYCSW["CONFIGURATION"]["metadata:main"]["identification_keywords"].replace(",", " "),
167+
"shortname": settings.PYCSW["CONFIGURATION"]["metadata"]["identification"]["title"],
168+
"description": settings.PYCSW["CONFIGURATION"]["metadata"]["identification"]["description"],
169+
"developer": settings.PYCSW["CONFIGURATION"]["metadata"]["contact"]["name"],
170+
"contact": settings.PYCSW["CONFIGURATION"]["metadata"]["contact"]["email"],
171+
"attribution": settings.PYCSW["CONFIGURATION"]["metadata"]["provider"]["name"],
172+
"tags": " ".join(settings.PYCSW["CONFIGURATION"]["metadata"]["identification"]["keywords"]),
173173
"url": settings.SITEURL.rstrip("/") if settings.SITEURL.startswith("http") else settings.SITEURL,
174174
}
175175

geonode/layers/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def dataset_feature_catalogue(request, layername, template="../../catalogue/temp
171171
context_dict = {
172172
"dataset": layer,
173173
"attributes": attributes,
174-
"metadata": settings.PYCSW["CONFIGURATION"]["metadata:main"],
174+
"metadata": settings.PYCSW["CONFIGURATION"]["metadata"],
175175
}
176176
register_event(request, "view", layer)
177177
return render(request, template, context=context_dict, content_type="application/xml")

geonode/local_settings.py.geoserver.sample

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ PYCSW = {
178178
"home": ".",
179179
"url": CATALOGUE["default"]["URL"],
180180
"encoding": "UTF-8",
181-
"language": LANGUAGE_CODE,
181+
"language": LANGUAGE_CODE if LANGUAGE_CODE in ("en", "fr", "el") else "en",
182182
"maxrecords": "20",
183183
"pretty_print": "true",
184184
# 'domainquerytype': 'range',
@@ -191,43 +191,52 @@ PYCSW = {
191191
"allowed_ips": "*",
192192
# 'csw_harvest_pagesize': '10',
193193
},
194-
"metadata:main": {
195-
"identification_title": "GeoNode Catalogue",
196-
"identification_abstract": "GeoNode is an open source platform"
197-
" that facilitates the creation, sharing, and collaborative use"
198-
" of geospatial data",
199-
"identification_keywords": "sdi, catalogue, discovery, metadata," " GeoNode",
200-
"identification_keywords_type": "theme",
201-
"identification_fees": "None",
202-
"identification_accessconstraints": "None",
203-
"provider_name": "Organization Name",
204-
"provider_url": SITEURL,
205-
"contact_name": "Lastname, Firstname",
206-
"contact_position": "Position Title",
207-
"contact_address": "Mailing Address",
208-
"contact_city": "City",
209-
"contact_stateorprovince": "Administrative Area",
210-
"contact_postalcode": "Zip or Postal Code",
211-
"contact_country": "Country",
212-
"contact_phone": "+xx-xxx-xxx-xxxx",
213-
"contact_fax": "+xx-xxx-xxx-xxxx",
214-
"contact_email": "Email Address",
215-
"contact_url": "Contact URL",
216-
"contact_hours": "Hours of Service",
217-
"contact_instructions": "During hours of service. Off on " "weekends.",
218-
"contact_role": "pointOfContact",
219-
},
220-
"metadata:inspire": {
221-
"enabled": "true",
194+
"metadata": {
195+
"inspire": {
196+
"enabled": True,
222197
"languages_supported": "eng,gre",
223198
"default_language": "eng",
224199
"date": "YYYY-MM-DD",
225200
"gemet_keywords": "Utility and governmental services",
226201
"conformity_service": "notEvaluated",
227202
"contact_name": "Organization Name",
228203
"contact_email": "Email Address",
229-
"temp_extent": "YYYY-MM-DD/YYYY-MM-DD",
230-
},
204+
"temp_extent": {
205+
"begin": "YYYY-MM-DD",
206+
"end": "YYYY-MM-DD"
207+
},
208+
},
209+
"identification": {
210+
"title": "GeoNode Catalogue",
211+
"description": "GeoNode is an open source platform"
212+
" that facilitates the creation, sharing, and collaborative use"
213+
" of geospatial data",
214+
"keywords": "sdi, catalogue, discovery, metadata," " GeoNode",
215+
"keywords_type": "theme",
216+
"fees": "None",
217+
"accessconstraints": "None",
218+
},
219+
"provider": {
220+
"name": "Organization Name",
221+
"url": SITEURL,
222+
},
223+
"contact": {
224+
"name": "Lastname, Firstname",
225+
"position": "Position Title",
226+
"address": "Mailing Address",
227+
"city": "City",
228+
"stateorprovince": "Administrative Area",
229+
"postalcode": "Zip or Postal Code",
230+
"country": "Country",
231+
"phone": "+xx-xxx-xxx-xxxx",
232+
"fax": "+xx-xxx-xxx-xxxx",
233+
"email": "Email Address",
234+
"url": "Contact URL",
235+
"hours": "Hours of Service",
236+
"instructions": "During hours of service. Off on " "weekends.",
237+
"role": "pointOfContact",
238+
}
239+
}
231240
}
232241
}
233242

@@ -274,10 +283,10 @@ if GEONODE_CLIENT_LAYER_PREVIEW_LIBRARY == "mapstore":
274283
pycsw_config = PYCSW["CONFIGURATION"]
275284
if pycsw_config:
276285
pycsw_catalogue = {
277-
("%s" % pycsw_config["metadata:main"]["identification_title"]): {
286+
("%s" % pycsw_config["metadata"]["identification"]): {
278287
"url": CATALOGUE["default"]["URL"],
279288
"type": "csw",
280-
"title": pycsw_config["metadata:main"]["identification_title"],
289+
"title": pycsw_config["metadata"]["identification"]["title"],
281290
"autoload": True,
282291
}
283292
}

geonode/settings.py

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,42 +1135,51 @@
11351135
"allowed_ips": "*",
11361136
# 'csw_harvest_pagesize': '10',
11371137
},
1138-
"metadata:main": {
1139-
"identification_title": "GeoNode Catalogue",
1140-
"identification_abstract": "GeoNode is an open source platform"
1141-
" that facilitates the creation, sharing, and collaborative use"
1142-
" of geospatial data",
1143-
"identification_keywords": "sdi, catalogue, discovery, metadata," " GeoNode",
1144-
"identification_keywords_type": "theme",
1145-
"identification_fees": "None",
1146-
"identification_accessconstraints": "None",
1147-
"provider_name": "Organization Name",
1148-
"provider_url": SITEURL,
1149-
"contact_name": "Lastname, Firstname",
1150-
"contact_position": "Position Title",
1151-
"contact_address": "Mailing Address",
1152-
"contact_city": "City",
1153-
"contact_stateorprovince": "Administrative Area",
1154-
"contact_postalcode": "Zip or Postal Code",
1155-
"contact_country": "Country",
1156-
"contact_phone": "+xx-xxx-xxx-xxxx",
1157-
"contact_fax": "+xx-xxx-xxx-xxxx",
1158-
"contact_email": "Email Address",
1159-
"contact_url": "Contact URL",
1160-
"contact_hours": "Hours of Service",
1161-
"contact_instructions": "During hours of service. Off on " "weekends.",
1162-
"contact_role": "pointOfContact",
1163-
},
1164-
"metadata:inspire": {
1165-
"enabled": "true",
1166-
"languages_supported": "eng,gre",
1167-
"default_language": "eng",
1168-
"date": "YYYY-MM-DD",
1169-
"gemet_keywords": "Utility and governmental services",
1170-
"conformity_service": "notEvaluated",
1171-
"contact_name": "Organization Name",
1172-
"contact_email": "Email Address",
1173-
"temp_extent": "YYYY-MM-DD/YYYY-MM-DD",
1138+
"metadata": {
1139+
"inspire": {
1140+
"enabled": True,
1141+
"languages_supported": ["eng", "gre"],
1142+
"default_language": "eng",
1143+
"date": "YYYY-MM-DD",
1144+
"gemet_keywords": ["Utility and governmental services"],
1145+
"conformity_service": "notEvaluated",
1146+
"contact_name": "Organization Name",
1147+
"contact_email": "Email Address",
1148+
"temp_extent": {
1149+
"begin": "YYYY-MM-DD",
1150+
"end": "YYYY-MM-DD",
1151+
},
1152+
},
1153+
"identification": {
1154+
"title": "GeoNode Catalogue",
1155+
"description": "GeoNode is an open source platform"
1156+
" that facilitates the creation, sharing, and collaborative use"
1157+
" of geospatial data",
1158+
"keywords": ["sdi", "catalogue", "discovery", "metadata", "GeoNode"],
1159+
"keywords_type": "theme",
1160+
"fees": "None",
1161+
"accessconstraints": "None",
1162+
},
1163+
"provider": {
1164+
"name": "Organization Name",
1165+
"url": SITEURL,
1166+
},
1167+
"contact": {
1168+
"name": "Lastname, Firstname",
1169+
"position": "Position Title",
1170+
"address": "Mailing Address",
1171+
"city": "City",
1172+
"stateorprovince": "Administrative Area",
1173+
"postalcode": "Zip or Postal Code",
1174+
"country": "Country",
1175+
"phone": "+xx-xxx-xxx-xxxx",
1176+
"fax": "+xx-xxx-xxx-xxxx",
1177+
"email": "Email Address",
1178+
"url": "Contact URL",
1179+
"hours": "Hours of Service",
1180+
"instructions": "During hours of service. Off on " "weekends.",
1181+
"role": "pointOfContact",
1182+
},
11741183
},
11751184
}
11761185
}
@@ -1454,10 +1463,10 @@ def get_geonode_catalogue_service():
14541463
pycsw_config = PYCSW["CONFIGURATION"]
14551464
if pycsw_config:
14561465
pycsw_catalogue = {
1457-
f"{pycsw_config['metadata:main']['identification_title']}": {
1466+
f"{pycsw_config['metadata']['identification']}": {
14581467
"url": CATALOGUE["default"]["URL"],
14591468
"type": "csw",
1460-
"title": pycsw_config["metadata:main"]["identification_title"],
1469+
"title": pycsw_config["metadata"]["identification"]["title"],
14611470
"autoload": True,
14621471
"layerOptions": {"tileSize": DEFAULT_TILE_SIZE},
14631472
}

geonode/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ def ident_json(request):
108108
site_url = settings.SITEURL.rstrip("/") if settings.SITEURL.startswith("http") else settings.SITEURL
109109
json_data = {}
110110
json_data["siteurl"] = site_url
111-
json_data["name"] = settings.PYCSW["CONFIGURATION"]["metadata:main"]["identification_title"]
111+
json_data["name"] = settings.PYCSW["CONFIGURATION"]["metadata"]["identification"]["title"]
112112

113113
json_data["poc"] = {
114-
"name": settings.PYCSW["CONFIGURATION"]["metadata:main"]["contact_name"],
115-
"email": settings.PYCSW["CONFIGURATION"]["metadata:main"]["contact_email"],
114+
"name": settings.PYCSW["CONFIGURATION"]["metadata"]["contact"]["name"],
115+
"email": settings.PYCSW["CONFIGURATION"]["metadata"]["contact"]["email"],
116116
"twitter": f"https://twitter.com/{settings.TWITTER_SITE}",
117117
}
118118

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@ oauthlib==3.2.2
4646
pyjwt==2.8.0
4747

4848
# geopython dependencies
49+
git+https://github.com/geopython/[email protected]#egg=pycsw
4950
pyproj<3.7.0
5051
OWSLib==0.31.0
51-
pycsw==2.6.1
5252
SQLAlchemy==2.0.30 # required by PyCSW
5353
Shapely==1.8.5.post1
5454
mercantile==1.2.1
5555
numpy==1.26.*
56+
Jinja2==3.1.4
5657

5758
# # Apps with packages provided in GeoNode's PPA on Launchpad.
5859

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ install_requires =
7474
# geopython dependencies
7575
pyproj<3.7.0
7676
OWSLib==0.31.0
77-
pycsw==2.6.1
77+
pycsw @ git+https://github.com/geopython/[email protected]#egg=pycsw
7878
SQLAlchemy==2.0.30 # required by PyCSW
7979
Shapely==1.8.5.post1
8080
mercantile==1.2.1
8181
numpy==1.26.*
82+
Jinja2==3.1.4
8283

8384
# # Apps with packages provided in GeoNode's PPA on Launchpad.
8485

0 commit comments

Comments
 (0)