[PATCH 1 of 9 saem_ref] [eac] Move message registration to the class generating them

Sylvain Thenault sylvain.thenault at logilab.fr
Thu Mar 16 17:38:16 CET 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1489669270 -3600
#      Thu Mar 16 14:01:10 2017 +0100
# Node ID 869f68fecd89d0c6e98c34577be789d79289f497
# Parent  fa90b7236de0e15341a537d1f720dec5392fecbc
[eac] Move message registration to the class generating them

through its relations_info definition.

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
@@ -591,10 +591,20 @@ class AuthorityRecordRelationsTab(Subvie
                      label=_('HierarchicalRelation (child)')),
         RelationInfo('hierarchical_parent', 'object',
                      label=_('HierarchicalRelation (parent)')),
         ('association_from', 'object'),
     ]
+    _('creating AssociationRelation (AssociationRelation association_from '
+      'AuthorityRecord %(linkto)s)')
+    _("creating ChronologicalRelation (ChronologicalRelation "
+      "chronological_predecessor AuthorityRecord %(linkto)s)")
+    _("creating ChronologicalRelation (ChronologicalRelation "
+      "chronological_successor AuthorityRecord %(linkto)s)")
+    _('creating HierarchicalRelation (HierarchicalRelation hierarchical_child '
+      'AuthorityRecord %(linkto)s)')
+    _('creating HierarchicalRelation (HierarchicalRelation hierarchical_parent '
+      'AuthorityRecord %(linkto)s)')
 
 
 pvs.tag_object_of(('*', 'association_from', 'AuthorityRecord'), 'hidden')
 pvs.tag_object_of(('*', 'association_to', 'AuthorityRecord'), 'hidden')
 
@@ -626,12 +636,10 @@ class AssociationRelationView(EntityView
     """Extended 'oneline' view for AssociationRelation"""
     __regid__ = 'saem_ref.associationrelation'
     __select__ = (EntityView.__select__ &
                   is_instance('AssociationRelation') & match_kwargs('main_record'))
 
-    _('creating AssociationRelation (AssociationRelation association_from '
-      'AuthorityRecord %(linkto)s)')
 
     @editlinks(icon_info=True)
     def entity_call(self, entity, main_record):
         for other_record in (entity.association_from[0], entity.association_to[0]):
             if other_record != main_record:
@@ -656,14 +664,10 @@ class ChronologicalRelationView(EntityVi
     __regid__ = 'saem_ref.authorityrecord.chronological_relation'
     __select__ = EntityView.__select__ & (
         has_related_entities('chronological_successor', role='object') |
         has_related_entities('chronological_predecessor', role='object'))
     title = _('ChronologicalRelation_plural')
-    _("creating ChronologicalRelation (ChronologicalRelation "
-      "chronological_predecessor AuthorityRecord %(linkto)s)")
-    _("creating ChronologicalRelation (ChronologicalRelation "
-      "chronological_successor AuthorityRecord %(linkto)s)")
 
     def entity_call(self, entity, **kwargs):
         self.w(tags.h2(self._cw._(self.title).lower()))
         rset = self._cw.execute('(Any X WHERE X eid %(eid)s) '
                                 'UNION (Any S WHERE RP chronological_predecessor X, '
@@ -796,15 +800,10 @@ class AuthorityRecordGraphView(EntityVie
         has_related_entities('hierarchical_child', role='object'))
 
     __regid__ = 'saem_ref.authorityrecord.hierarchical-links'
     title = _('HierarchicalRelation_plural')
 
-    _('creating HierarchicalRelation (HierarchicalRelation hierarchical_child '
-      'AuthorityRecord %(linkto)s)')
-    _('creating HierarchicalRelation (HierarchicalRelation hierarchical_parent '
-      'AuthorityRecord %(linkto)s)')
-
     def entity_call(self, entity, **kwargs):
         self.w(tags.h2(self._cw._(self.title).lower()))
         self._cw.add_js(('jquery.js', 'jquery.jOrgChart.js'))
         self._cw.add_css('jquery.jOrgChart.css')
         hiera_list = u'<ul id="hierarchical_relations" style="display:none">'


More information about the saem-devel mailing list