web/views/baseforms.py
branchtls-sprint
changeset 633 087e3f1e87c8
parent 582 0260b3b71d71
child 692 800592b8d39b
--- a/web/views/baseforms.py	Mon Feb 16 19:20:30 2009 +0100
+++ b/web/views/baseforms.py	Mon Feb 16 19:50:10 2009 +0100
@@ -17,9 +17,9 @@
 from cubicweb.interfaces import IWorkflowable
 from cubicweb.common.utils import make_uid
 from cubicweb.common.uilib import cut
-from cubicweb.common.selectors import (accept_etype, match_kwargs,
-                                    one_line_rset, implement_interface,
-                                    match_form_params, accept)
+from cubicweb.common.selectors import (specified_etype_implements,
+                                       match_kwargs, match_form_params, 
+                                       one_line_rset, implements)
 from cubicweb.common.view import EntityView
 from cubicweb.web import INTERNAL_FIELD_VALUE, stdmsgs, eid_param
 from cubicweb.web.controller import NAV_FORM_PARAMETERS
@@ -90,9 +90,7 @@
     id = 'statuschange'
     title = _('status change')
 
-    __selectors__ = (implement_interface, match_form_params)
-    accepts_interfaces = (IWorkflowable,)
-    form_params = ('treid',)
+    __selectors__ = (implements(IWorkflowable), match_form_params('treid'))
 
     def cell_call(self, row, col, vid='secondary'):
         entity = self.entity(row, col)
@@ -153,8 +151,7 @@
 
 class ClickAndEditForm(EntityForm):
     id = 'reledit'
-    __selectors__ = (match_kwargs, )
-    expected_kwargs = ('rtype',)
+    __selectors__ = (match_kwargs('rtype'), )
 
     #FIXME editableField class could be toggleable from userprefs
 
@@ -219,7 +216,7 @@
     dynamic default values such as the 'tomorrow' date or the user's login
     being connected
     """    
-    __selectors__ = (one_line_rset, accept)
+    __selectors__ = (one_line_rset, implements('Any'))
 
     id = 'edition'
     title = _('edition')
@@ -526,7 +523,7 @@
 
     
 class CreationForm(EditionForm):
-    __selectors__ = (accept_etype, )
+    __selectors__ = (specified_etype_implements('Any'), )
     id = 'creation'
     title = _('creation')
     
@@ -639,8 +636,8 @@
 
 class InlineEntityCreationForm(InlineFormMixIn, CreationForm):
     id = 'inline-creation'
-    __selectors__ = (match_kwargs, accept_etype)
-    expected_kwargs = ('ptype', 'peid', 'rtype')
+    __selectors__ = (match_kwargs('ptype', 'peid', 'rtype'), specified_etype_implements('Any'))
+    
     
     EDITION_BODY = u'''\
 <div id="div-%(parenteid)s-%(rtype)s-%(eid)s" class="inlinedform">
@@ -678,8 +675,7 @@
 
 class InlineEntityEditionForm(InlineFormMixIn, EditionForm):
     id = 'inline-edition'
-    __selectors__ = (accept, match_kwargs)
-    expected_kwargs = ('ptype', 'peid', 'rtype')
+    __selectors__ = (implements('Any'), match_kwargs('ptype', 'peid', 'rtype'))
     
     EDITION_BODY = u'''\
 <div onclick="restoreInlinedEntity('%(parenteid)s', '%(rtype)s', '%(eid)s')" id="div-%(parenteid)s-%(rtype)s-%(eid)s" class="inlinedform">   
@@ -881,8 +877,7 @@
 
 class UnrelatedDivs(EntityView):
     id = 'unrelateddivs'
-    __selectors__ = (match_form_params,)
-    form_params = ('relation',)
+    __selectors__ = (match_form_params('relation',),)
 
     @property
     def limit(self):
@@ -993,7 +988,6 @@
     THIS IS A TEXT VIEW. DO NOT HTML_ESCAPE
     """
     id = 'combobox'
-    accepts = ('Any',)
     title = None
     
     def cell_call(self, row, col):