Simplify uicfg setup loop
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 25 Aug 2016 09:46:58 +0200
changeset 1496 bdb48b8daaab
parent 1495 cc21266f79c3
child 1497 cb556ac5ce2f
Simplify uicfg setup loop
views/archivetransfer.py
--- a/views/archivetransfer.py	Wed Aug 24 16:02:13 2016 +0200
+++ b/views/archivetransfer.py	Thu Aug 25 09:46:58 2016 +0200
@@ -55,17 +55,15 @@
 
 for rtype, role in at_ordered_fields:
     if rtype.endswith('agency'):
-        vid = 'seda.reledit.simplelink'
-        novalue_label = _('<no value specified>')
+        assert role == 'subject'
+        rec.tag_subject_of(('SEDAArchiveTransfer', rtype, '*'),
+                           {'rvid': 'seda.reledit.simplelink',
+                            'novalue_label': _('<no value specified>')})
     else:
-        vid = 'seda.reledit.text'
-        novalue_label = _('<unauthorized>')
-    if role == 'subject':
-        rec.tag_subject_of(('SEDAArchiveTransfer', rtype, '*'),
-                           {'rvid': vid, 'novalue_label': novalue_label})
-    else:
+        assert role == 'object'
         rec.tag_object_of(('*', rtype, 'SEDAArchiveTransfer'),
-                          {'rvid': vid, 'novalue_label': novalue_label})
+                          {'rvid': 'seda.reledit.text',
+                           'novalue_label': _('<unauthorized>')})
 
 affk.set_field_kwargs('SEDAArchiveTransfer', 'title', widget=fw.TextInput({'size': 80}))
 affk.set_fields_order('SEDAArchiveTransfer',