[PATCH 1 of 4 seda] [views] Simplify afs rtags management a bit

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Apr 21 17:53:25 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1492783425 -7200
#      Fri Apr 21 16:03:45 2017 +0200
# Node ID 5bfec4248b695754784caf9149c5a6e466022b4a
# Parent  6caf89c3e630b6c5052649d016bd5ffc0a08166c
[views] Simplify afs rtags management a bit

by avoiding `au_content_afs` copy of `afs`, which may be unwillingly selected
while for instance `simplified_afs` is expected.

Since this is tricky to handle, simplify things a bit by adding rules formerly
in `au_content_afs` as default rules and only create on custom `afs` copy for
'reference' archive unit.

Related to extranet #18337031

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
@@ -1058,11 +1058,20 @@ class SimplifiedArchiveUnitDataObjectRef
 pvs.tag_object_of(('*', 'seda_data_object_reference', CONTENT_ETYPE),
                   'hidden')
 afs.tag_object_of(('*', 'seda_data_object_reference', CONTENT_ETYPE),
                   'main', 'hidden')
 
+# add rtags for content archive unit in default afs
+afs.tag_object_of(
+    ('*', 'seda_archive_unit_ref_id_from', 'SEDAAltArchiveUnitArchiveUnitRefId'),
+    'inlined', 'hidden')
+afs.tag_subject_of(
+    ('SEDAAltArchiveUnitArchiveUnitRefId',
+     'seda_seq_alt_archive_unit_archive_unit_ref_id_management', '*'),
+    'inlined', 'inlined')
 
+# and create a custom one for reference archive unit
 au_ref_afs = copy_rtag(afs, __name__,
                        is_instance('SEDAAltArchiveUnitArchiveUnitRefId')
                        & is_archive_unit_ref())
 au_ref_afs.tag_object_of(
     ('*', 'seda_archive_unit_ref_id_from', 'SEDAAltArchiveUnitArchiveUnitRefId'),
@@ -1070,21 +1079,10 @@ au_ref_afs.tag_object_of(
 au_ref_afs.tag_subject_of(
     ('SEDAAltArchiveUnitArchiveUnitRefId',
      'seda_seq_alt_archive_unit_archive_unit_ref_id_management', '*'),
     'inlined', 'hidden')
 
-au_content_afs = copy_rtag(afs, __name__,
-                           is_instance('SEDAAltArchiveUnitArchiveUnitRefId')
-                           & ~is_archive_unit_ref())
-au_content_afs.tag_object_of(
-    ('*', 'seda_archive_unit_ref_id_from', 'SEDAAltArchiveUnitArchiveUnitRefId'),
-    'inlined', 'hidden')
-au_content_afs.tag_subject_of(
-    ('SEDAAltArchiveUnitArchiveUnitRefId',
-     'seda_seq_alt_archive_unit_archive_unit_ref_id_management', '*'),
-    'inlined', 'inlined')
-
 
 class AltArchiveUnitRefIdSimplifiedAutomaticEntityForm(widgets.SimplifiedAutomaticEntityForm):
     """Force display of AltArchiveUnitArchiveUnitRefId's sub-ArchiveUnitRefId or
     SeqAltArchiveUnitArchiveUnitRefIdManagement (uicfg will control which of them is displayed).
     """


More information about the saem-devel mailing list