Simplify uicfg rules building for physical/binary data objects
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 26 Aug 2016 09:05:03 +0200
changeset 1576 370df5f16508
parent 1575 2d1ed86e4725
child 1577 946cd9fa7dde
Simplify uicfg rules building for physical/binary data objects There should be no need for etype specific rules, default rules will be overriden.
views/dataobject.py
--- a/views/dataobject.py	Fri Aug 26 08:29:44 2016 +0200
+++ b/views/dataobject.py	Fri Aug 26 09:05:03 2016 +0200
@@ -100,26 +100,19 @@
                     'subvid': 'seda.object-ref.archive-unit',
                     'label': _('referenced by:')})
 
-# hide some relation from autoform because of limitation of _container_eid
-afs.tag_object_of(('*', 'seda_compressed', 'SEDABinaryDataObject'), 'main', 'hidden')
-pvs.tag_object_of(('*', 'seda_compressed', 'SEDABinaryDataObject'), 'attributes')
-rec.tag_object_of(('*', 'seda_compressed', 'SEDABinaryDataObject'),
-                  {'rvid': 'seda.reledit.complexlink',
-                   'novalue_label': _('<unauthorized>')})
+pvs.tag_object_of(('*', 'seda_target', '*'), 'hidden')  # in the relationship tab
+for rtype in ('seda_compressed', 'seda_data_object_version_from'):
+    # hide relation from autoform because of limitation of _container_eid
+    afs.tag_object_of(('*', rtype, '*'), 'main', 'hidden')
+    pvs.tag_object_of(('*', rtype, '*'), 'attributes')
+    rec.tag_object_of(('*', rtype, '*'),
+                      {'rvid': 'seda.reledit.complexlink',
+                       'novalue_label': _('<unauthorized>')})
 
 rec.tag_subject_of(('SEDABinaryDataObject', 'seda_alt_binary_data_object_attachment', '*'),
                    {'rvid': 'seda.reledit.alternative',
                     'novalue_label': _('<unauthorized>')})
 
-for etype in ('SEDABinaryDataObject', 'SEDAPhysicalDataObject'):
-    afs.tag_object_of(('*', 'seda_data_object_version_from', etype), 'main', 'hidden')
-    pvs.tag_object_of(('*', 'seda_data_object_version_from', etype), 'attributes')
-    rec.tag_object_of(('*', 'seda_data_object_version_from', etype),
-                      {'rvid': 'seda.reledit.complexlink',
-                       'novalue_label': _('<unauthorized>')})
-
-    pvs.tag_object_of(('*', 'seda_target', etype), 'hidden')  # in the relationship tab
-
 
 def uri_cardinality_vocabulary(form, field):
     req = form._cw