[PATCH 11 of 13 saem_ref] [eac] Fix erroneous title for list section of hierarchical/chronological relation

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Mar 31 17:57:23 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1490974243 -7200
#      Fri Mar 31 17:30:43 2017 +0200
# Node ID 6164438f2f97572be22b75e792b8bce1422a32fd
# Parent  20e961fcf20d8e4fd2be7025b382224f32cbd6e2
[eac] Fix erroneous title for list section of hierarchical/chronological relation

and update view's parameters to make this less error prone.

Closes extranet #15812299

diff --git a/cubicweb_saem_ref/views/authorityrecord.py b/cubicweb_saem_ref/views/authorityrecord.py
--- a/cubicweb_saem_ref/views/authorityrecord.py
+++ b/cubicweb_saem_ref/views/authorityrecord.py
@@ -663,17 +663,17 @@ pvs.tag_object_of(('*', 'chronological_p
 pvs.tag_object_of(('*', 'chronological_successor', 'AuthorityRecord'), 'hidden')
 
 
 class RelationRelatedView(EntityView):
     __regid__ = 'saem.authorityrecord.relation.related'
-    __select__ = match_kwargs('from_rtype', 'to_rtype', 'title')
+    __select__ = match_kwargs('entity_rtype', 'target_rtype', 'title')
 
-    def entity_call(self, entity, from_rtype, to_rtype, title):
+    def entity_call(self, entity, entity_rtype, target_rtype, title):
         rset = self._cw.execute(
             'Any X,XD,XSD,XED,XAF,XAT WHERE X {} XAF, XAF eid %(eid)s, '
             'X description XD, X start_date XSD, X end_date XED, X {} XAT'
-            .format(from_rtype, to_rtype), {'eid': entity.eid})
+            .format(entity_rtype, target_rtype), {'eid': entity.eid})
         if rset:
             self.w(tags.h3(title))
             self._cw.view('list', rset=rset, w=self.w,
                           subvid='saem.authorityrecord.relation',
                           main_record=entity,
@@ -703,16 +703,16 @@ class ChronologicalRelationView(EntityVi
         json_url = self._cw.build_url('view', rql=entity.as_rset().printable_rql(),
                                       vid='saem.authorityrecord-timeline-json')
         self._cw.view('vtimeline', rset=rset, w=self.w, custom_settings={'source': json_url})
 
         self._cw.view('saem.authorityrecord.relation.related', entity=entity, w=self.w,
-                      from_rtype='chronological_predecessor',
-                      to_rtype='chronological_successor',
+                      entity_rtype='chronological_successor',
+                      target_rtype='chronological_predecessor',
                       title=self._cw._('predecessors'))
         self._cw.view('saem.authorityrecord.relation.related', entity=entity, w=self.w,
-                      from_rtype='chronological_successor',
-                      to_rtype='chronological_predecessor',
+                      entity_rtype='chronological_predecessor',
+                      target_rtype='chronological_successor',
                       title=self._cw._('successors'))
 
 
 class AuthorityRecordTimelineJsonView(EntityView):
     """JSON view for agent with chronological relations to be used with vtimeline view."""
@@ -812,16 +812,16 @@ class AuthorityRecordGraphView(EntityVie
             self.w(self._cw._('AuthorityRecord %s has several parents:') % entity.dc_title())
             self._cw.view('list', rset_parents, w=self.w)
             self.w(u'</div>')
 
         self._cw.view('saem.authorityrecord.relation.related', entity=entity, w=self.w,
-                      from_rtype='hierarchical_parent',
-                      to_rtype='hierarchical_child',
-                      title=self._cw._('parents'))
+                      entity_rtype='hierarchical_child',
+                      target_rtype='hierarchical_parent',
+                      title=self._cw._('parent'))
         self._cw.view('saem.authorityrecord.relation.related', entity=entity, w=self.w,
-                      from_rtype='hierarchical_child',
-                      to_rtype='hierarchical_parent',
-                      title=self._cw._('children'))
+                      entity_rtype='hierarchical_parent',
+                      target_rtype='hierarchical_child',
+                      title=self._cw._('child'))
 
 
 pvs.tag_object_of(('*', 'hierarchical_parent', 'AuthorityRecord'), 'hidden')
 pvs.tag_object_of(('*', 'hierarchical_child', 'AuthorityRecord'), 'hidden')


More information about the saem-devel mailing list