cleanup
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 31 Aug 2009 17:11:03 +0200
changeset 59 51e2024dcfc9
parent 58 ff3b6ff260f3
child 60 dfea5784bb9e
cleanup
views.py
--- a/views.py	Mon Aug 31 17:10:59 2009 +0200
+++ b/views.py	Mon Aug 31 17:11:03 2009 +0200
@@ -17,17 +17,20 @@
 from cubicweb.web import stdmsgs, uicfg, component, facet
 from cubicweb.web.views import primary, baseviews, basecontrollers
 
-# displayed by the above component
-uicfg.primaryview_section.tag_object_of(('*', 'applied_to', '*'), 'hidden')
-uicfg.primaryview_section.tag_subject_of(('*', 'applied_to', '*'), 'hidden')
+_pvs = uicfg.primaryview_section
+_pvs.tag_object_of(('*', 'applied_to', '*'), 'hidden')
+_pvs.tag_subject_of(('*', 'applied_to', '*'), 'hidden')
+_pvs.tag_object_of(('*', 'included_in', 'Classification'), 'hidden')
 
-uicfg.actionbox_appearsin_addmenu.tag_object_of(('CodeKeyword', 'included_in', 'Classification'), True)
-uicfg.actionbox_appearsin_addmenu.tag_object_of(('Keyword', 'included_in', 'Classification'), True)
-uicfg.actionbox_appearsin_addmenu.tag_object_of(('CodeKeyword', 'subkeyword_of', 'CodeKeyword'), True)
-uicfg.actionbox_appearsin_addmenu.tag_object_of(('Keyword', 'subkeyword_of', 'Keyword'), True)
-uicfg.autoform_section.tag_object_of(('Keyword', 'in_state', '*'), 'generated')
+_abaa = uicfg.actionbox_appearsin_addmenu
+_abaa.tag_object_of(('CodeKeyword', 'included_in', 'Classification'), True)
+_abaa.tag_object_of(('Keyword', 'included_in', 'Classification'), True)
+_abaa.tag_object_of(('CodeKeyword', 'subkeyword_of', 'CodeKeyword'), True)
+_abaa.tag_object_of(('Keyword', 'subkeyword_of', 'Keyword'), True)
 
-uicfg.primaryview_section.tag_object_of(('*', 'included_in', 'Classification'), 'hidden')
+_afs = uicfg.autoform_section
+_afs.tag_object_of(('Keyword', 'in_state', '*'), 'generated')
+
 
 # classification views ########################################################
 
@@ -43,6 +46,7 @@
                                 'C eid %(x)s', {'x': entity.eid})
         self.wview('treeview', rset, 'null')
 
+
 # keyword views ###############################################################
 
 class KeywordPrimaryView(primary.PrimaryView):
@@ -55,18 +59,6 @@
         rset = entity.related('subkeyword_of','object')
         self.wview('treeview', rset, 'null')
 
-# class KeywordPrimaryViewBis(KeywordPrimaryView):
-#     __select__ = implements('Keyword') & relation_possible('applied_to', 'subject')
-
-#     def cell_call(self, row, col, **kwargs):
-#         entity = self.entity(row, col)
-#         super(KeywordPrimaryViewBis, self).cell_call(row, col, **kwargs)
-#         rset = entity.related('applied_to')
-#         if rset:
-#             self.w(u'<h2>%s</h2><div>' % self.req._('Tagged objects'))
-#             self.wview('list', rset)
-#         else:
-#             self.w(self.req._('no tagged object'))
 
 class KeywordOneLineView(baseviews.InContextView):
     __select__ = implements('Keyword')
@@ -83,8 +75,9 @@
 
 class KeywordComboBoxView(TreePathMixIn, EntityView):
     """display keyword in edition's combobox"""
+    id = 'combobox'
     __select__ = implements('Keyword', 'Classification')
-    id = 'combobox'
+
     item_vid = 'text'
     separator = u' > '
 
@@ -118,6 +111,7 @@
             self.w(u'<div class="%s hidden" id="%s"></div>\n' % (
                 self.div_class(), self.div_id()))
 
+
 class AddKeywordVComponent(component.EntityVComponent):
     """the 'add keyword' component"""
     id = 'addkeywords'