[PATCH seda] Check for '_from' presence to detect complex link vs text

Sylvain Thenault sylvain.thenault at logilab.fr
Tue Jun 13 14:35:41 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1497348037 -7200
#      Tue Jun 13 12:00:37 2017 +0200
# Node ID 70aa0aea82ee10a758593a1b2db36674c919cc25
# Parent  50fc4ed12eae04aa395e78f8e01ceeffc1e83886
# Available At https://hg.logilab.org/review/cubes/seda
#              hg pull https://hg.logilab.org/review/cubes/seda -r 70aa0aea82ee
Check for '_from' presence to detect complex link vs text

instead of hard-coded 'language'. We should also match
seda_originating_agency_from. This heuristic is already used in
e.g. `rtags_from_rtype_role_targets` function.

Closes #17084054

diff --git a/cubicweb_seda/views/archiveunit.py b/cubicweb_seda/views/archiveunit.py
--- a/cubicweb_seda/views/archiveunit.py
+++ b/cubicweb_seda/views/archiveunit.py
@@ -913,11 +913,11 @@ for rtype, role in content_ordered_field
         pvs.tag_object_of(('*', rtype, CONTENT_ETYPE), 'attributes')
     if rtype == 'seda_description_level':
         novalue_label = _('<no value specified>')
     else:
         novalue_label = ' '
-    vid = 'seda.reledit.complexlink' if 'language' in rtype else 'seda.reledit.text'
+    vid = 'seda.reledit.complexlink' if rtype.endswith('_from') else 'seda.reledit.text'
     if role == 'subject':
         rec.tag_subject_of((CONTENT_ETYPE, rtype, '*'),
                            {'rvid': vid, 'novalue_label': novalue_label})
     else:
         rec.tag_object_of(('*', rtype, CONTENT_ETYPE),


More information about the saem-devel mailing list