update selectors
authorsylvain.thenault@logilab.fr
Thu, 30 Apr 2009 16:58:08 +0200
changeset 19 45097dc3ff89
parent 18 2c1498561959
child 20 2bed8286702a
update selectors
views.py
--- a/views.py	Thu Apr 30 16:53:48 2009 +0200
+++ b/views.py	Thu Apr 30 16:58:08 2009 +0200
@@ -11,9 +11,8 @@
 from logilab.mtconverter import html_escape
 
 from cubicweb.common.mixins import TreePathMixIn
-from cubicweb.common.view import EntityView
-from cubicweb.web import stdmsgs, uicfg
-from cubicweb.web.component import EntityVComponent
+from cubicweb.view import EntityView
+from cubicweb.web import stdmsgs, uicfg, component
 from cubicweb.web.views import baseviews
 
 # displayed by the above component
@@ -23,7 +22,7 @@
 # keyword views ###############################################################
 
 class KeywordPrimaryView(baseviews.PrimaryView):
-    accepts = ('Keyword',)
+    __select__ = implements('Keyword',)
 
     def cell_call(self, row, col, **kwargs):
         entity = self.entity(row, col)
@@ -37,7 +36,7 @@
 
 
 class KeywordOneLineView(baseviews.InContextView):
-    accepts = ('Keyword',)
+    __select__ = implements('Keyword',)
 
     def cell_call(self, row, col):
         entity = self.entity(row, col)
@@ -52,7 +51,7 @@
 
 class KeywordComboBoxView(TreePathMixIn, EntityView):
     """display keyword in edition's combobox"""
-    accepts = ('Keyword', 'Classification')
+    __select__ = implements('Keyword', 'Classification')
     id = 'combobox'
     item_vid = 'text'
     separator = u' > '
@@ -60,7 +59,7 @@
 
 # keyword component ###########################################################
 
-class KeywordBarVComponent(EntityVComponent):
+class KeywordBarVComponent(component.EntityVComponent):
     """the keywords path bar: display keywords of a tagged entity
     """
     id = 'keywordsbar'
@@ -71,7 +70,7 @@
     context = 'header'
     order = 152
     htmlclass = 'navigation'
-    
+
     def call(self, **kwargs):
         entity = self.entity(0)
         # managers can see all applied keyword, other users will only see validated
@@ -92,8 +91,9 @@
                 self.div_class(), self.div_id()))
 
 
-class AddKeywordVComponent(EntityVComponent):
+class AddKeywordVComponent(component.EntityVComponent):
     """the 'add keyword' component"""
+    __select__ = rql_condition('X is ET, CL classifies ET')
 
     id = 'addkeywords'
     etype = 'Keyword'
@@ -103,7 +103,6 @@
     context = 'header'
     order = 153
     htmlclass = 'navigation'
-    condition = 'X is ET, CL classifies ET'
 
     def call(self):
         self.add_js(['cubicweb.widgets.js', 'cubes.keyword.js'])