Commit afc9d2fe authored by Rémi Cardona's avatar Rémi Cardona
Browse files

[views] Remove cubicweb.rtags warnings

When this cube is used without 'addressbook', some relations are not
set.  views.py always sets uicfg tags for those relations, which throws
warnings in cubicweb.rtags.

The solution is to only call uicfg when the 'addressbook' is used.
parent 1d0bc84ea6f4
......@@ -17,25 +17,14 @@ from cubicweb.web.facet import AttributeFacet
_pvs =uicfg.primaryview_section
for attr in ('civility', 'firstname', 'surname'):
_pvs.tag_attribute(('Person', attr), 'hidden')
for rtype in ('phone', 'use_email',
'im_address', 'postal_address'):
_pvs.tag_subject_of(('Person', rtype, '*'), 'attributes')
_pvs.tag_subject_of(('Person', 'use_email', '*'), 'attributes')
_pvs.tag_subject_of(('Person', 'primary_email', '*'), 'hidden')
_pvdc = uicfg.primaryview_display_ctrl
_pvdc.tag_attribute(('Person', 'description'),
{'showlabel': False, 'order': 0})
_pvdc.tag_attribute(('Person', 'phone'), {'order': 1, 'vid': 'csv'})
_pvdc.tag_attribute(('Person', 'use_email'),
{'order': 2, 'vid': 'csv', 'label': 'use_email'})
_pvdc.tag_attribute(('Person', 'im_address'), {'order': 3, 'vid': 'csv'})
_pvdc.tag_attribute(('Person', 'postal_address'),
{'order': 4, 'vid': 'person.hrs'})
_afs = uicfg.autoform_section
_afs.tag_subject_of(('Person', 'phone', '*'), 'main', 'inlined')
_afs.tag_subject_of(('Person', 'postal_address', '*'), 'main', 'inlined')
_afs.tag_subject_of(('Person', 'im_address', '*'), 'main', 'inlined')
class HRSView(baseviews.CSVView):
......@@ -122,3 +111,19 @@ class CivilityFacet(AttributeFacet):
__regid__ = 'civility-facet'
__select__ = is_instance('Person')
rtype = 'civility'
def registration_callback(vreg):
vreg.register_all(globals().values(), __name__)
if 'addressbook' in vreg.config.cubes():
for rtype in ('phone', 'im_address', 'postal_address'):
_pvs.tag_subject_of(('Person', rtype, '*'), 'attributes')
_pvdc.tag_attribute(('Person', 'phone'), {'order': 1, 'vid': 'csv'})
_pvdc.tag_attribute(('Person', 'im_address'), {'order': 3, 'vid': 'csv'})
_pvdc.tag_attribute(('Person', 'postal_address'),
{'order': 4, 'vid': 'person.hrs'})
_afs = uicfg.autoform_section
_afs.tag_subject_of(('Person', 'phone', '*'), 'main', 'inlined')
_afs.tag_subject_of(('Person', 'postal_address', '*'), 'main', 'inlined')
_afs.tag_subject_of(('Person', 'im_address', '*'), 'main', 'inlined')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment