[PATCH 3 of 3 seda] [views] Aliasing cw's uicfg is not necessary anymore

Sylvain Thenault sylvain.thenault at logilab.fr
Fri Oct 6 17:03:28 CEST 2017


# HG changeset patch
# User Sylvain Thénault <sylvain.thenault at logilab.fr>
# Date 1507274419 -7200
#      Fri Oct 06 09:20:19 2017 +0200
# Node ID 8393644460a8ed1ee44c52efb3bbd8c2a89e16c9
# Parent  d547500012b2ec3a52c337bb3910126a4bd7ed58
# Available At https://hg.logilab.org/review/cubes/seda
#              hg pull https://hg.logilab.org/review/cubes/seda -r 8393644460a8
[views] Aliasing cw's uicfg is not necessary anymore

IIRC since we don't rely on load_module_from_name to load appobjects.

diff --git a/cubicweb_seda/views/__init__.py b/cubicweb_seda/views/__init__.py
--- a/cubicweb_seda/views/__init__.py
+++ b/cubicweb_seda/views/__init__.py
@@ -17,26 +17,25 @@
 from yams import BASE_TYPES
 
 from cubicweb import tags, neg_role
 from cubicweb.utils import UStringIO
 from cubicweb.web import formfields as ff
-# XXX alias to avoid side effect: uicfg will become our uicfg submodule. Not necessary with 3.23?
-from cubicweb.web.views import uicfg as cwuicfg
+from cubicweb.web.views import uicfg
 
 from ..xsd import XSDM_MAPPING
 from ..xsd2uicfg import FIRST_LEVEL_ETYPES
 from .widgets import SEDAMetaField
 
 
 CONTENT_ETYPE = 'SEDASeqAltArchiveUnitArchiveUnitRefIdManagement'
 
 
-pvs = cwuicfg.primaryview_section
-afs = cwuicfg.autoform_section
-aff = cwuicfg.autoform_field
-affk = cwuicfg.autoform_field_kwargs
-rec = cwuicfg.reledit_ctrl
+pvs = uicfg.primaryview_section
+afs = uicfg.autoform_section
+aff = uicfg.autoform_field
+affk = uicfg.autoform_field_kwargs
+rec = uicfg.reledit_ctrl
 
 pvs.tag_subject_of(('*', 'container', '*'), 'hidden')
 pvs.tag_object_of(('*', 'container', '*'), 'hidden')
 afs.tag_subject_of(('*', 'container', '*'), 'main', 'hidden')
 afs.tag_object_of(('*', 'container', '*'), 'main', 'hidden')
@@ -73,11 +72,11 @@ def rtags_from_xsd_element(etype, elemen
 def rtags_from_rtype_role_targets(etype, rtype_role_targets):
     """Return primary view section and display control rtags from a list of (`rtype`, `role`,
     `target entity type`).
     """
     ordered = []
-    rsection = cwuicfg.PrimaryViewSectionRelationTags(__module__=__name__)
+    rsection = uicfg.PrimaryViewSectionRelationTags(__module__=__name__)
     for rtype, role, target in rtype_role_targets:
         if role == 'subject':
             if target in BASE_TYPES:
                 # attribute handled by the main tab (e.g. filename), skip it
                 continue
@@ -94,11 +93,11 @@ def rtags_from_rtype_role_targets(etype,
             rec.tag_object_of(('*', rtype, '*'),
                               {'rvid': vid,
                                'novalue_label': ' '})
         rsection.tag_relation(relation, 'attributes')
         ordered.append((rtype, role))
-    display_ctrl = cwuicfg.DisplayCtrlRelationTags(__module__=__name__)
+    display_ctrl = uicfg.DisplayCtrlRelationTags(__module__=__name__)
     display_ctrl.set_fields_order(etype, ordered)
     return rsection, display_ctrl
 
 
 def add_subobject_link(entity, rtype, role, extraurlparams, msg=None, klass=None):


More information about the saem-devel mailing list