Skip to content

Commit c80076c

Browse files
committed
lang
1 parent b8f0bd6 commit c80076c

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

backend/src/design/plone/opendata/browser/dcatapit.py

+7-21
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ class RDFDownload(Download):
8080
mime_type = None
8181
_v_memoize_licenses = {}
8282
_v_memoize_themes = {}
83+
_v_memoize_languages = {
84+
"it": URIRef("http://publications.europa.eu/resource/authority/language/ITA"),
85+
"en": URIRef("http://publications.europa.eu/resource/authority/language/ENG"),
86+
}
8387

8488
def publishTraverse(self, request, name):
8589
super().publishTraverse(request=request, name=name)
@@ -162,26 +166,8 @@ def __call__(self):
162166
)
163167
if catalog_homepage:
164168
g.add((catalog_node, FOAF.homepage, Literal(catalog_homepage)))
165-
if lang == "it":
166-
g.add(
167-
(
168-
catalog_node,
169-
DCT.language,
170-
URIRef(
171-
"http://publications.europa.eu/resource/authority/language/ITA"
172-
),
173-
)
174-
)
175-
elif lang == "en":
176-
g.add(
177-
(
178-
catalog_node,
179-
DCT.language,
180-
URIRef(
181-
"http://publications.europa.eu/resource/authority/language/ENG"
182-
),
183-
)
184-
)
169+
if lang in self._v_memoize_languages:
170+
g.add((catalog_node, DCT.language, self._v_memoize_languages[lang]))
185171
catalog_issued = api.portal.get_registry_record(
186172
interface=IControlPanel, name="catalog_issued", default=None
187173
)
@@ -310,7 +296,7 @@ def __call__(self):
310296
if license_node:
311297
g.add((distribution_uri, DCT.license, license_node))
312298

313-
# XXX: per semplicità usiamo il rghtsHolder del dataset
299+
# XXX: per semplicità usiamo il rightsHolder del dataset
314300
g.add((distribution_uri, DCAT.contactPoint, holder_uri))
315301

316302
out = io.BytesIO()

0 commit comments

Comments
 (0)