Commit 4c112748 authored by Élodie Thiéblin's avatar Élodie Thiéblin
Browse files

feat: dc_title uses in priority a property containing keywords

"label", "title" or "name"

also added __regid__ otherwise the right dc_title function was not called
parent daff4f51f7ae
Pipeline #96364 passed with stages
in 1 minute and 1 second
......@@ -57,7 +57,8 @@
yield from self.filter_rdf_type(super().triples())
class {{fragment}}(AnyEntity):
__regid__ = "{{fragment}}"
def dc_title(self):
if self.label:
return self.label[0].value
......@@ -60,7 +61,23 @@
def dc_title(self):
if self.label:
return self.label[0].value
prefered_relations = []
for rschema, attrschema in self.e_schema.attribute_definitions():
if rschema.meta:
continue
if "label" in rschema.type:
prefered_relations.append(rschema.type)
elif "title" in rschema.type:
prefered_relations.append(rschema.type)
elif "name" in rschema.type:
prefered_relations.append(rschema.type)
for prefered_relation in prefered_relations:
value = self.cw_attr_value(prefered_relation)
if value is not None:
return self.printable_value(
rschema.type, value, attrschema.type, format="text/plain"
)
return super().dc_title()
{% endfor %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment