web/form.py
branchtls-sprint
changeset 1047 21d4d5e6aa45
parent 1032 25ec009daa95
child 1048 2a93712a6f8b
--- a/web/form.py	Wed Mar 11 11:13:41 2009 +0100
+++ b/web/form.py	Wed Mar 11 11:15:08 2009 +0100
@@ -17,8 +17,9 @@
 from yams.constraints import SizeConstraint, StaticVocabularyConstraint
 
 from cubicweb import typed_eid
+from cubicweb.appobject import AppObject
 from cubicweb.utils import ustrftime
-from cubicweb.selectors import match_form_params
+from cubicweb.selectors import yes, match_form_params, non_final_entity
 from cubicweb.view import NOINDEX, NOFOLLOW, View, EntityView, AnyRsetView
 from cubicweb.common.registerers import accepts_registerer
 from cubicweb.common.uilib import toggle_action
@@ -718,14 +719,17 @@
         return super(metafieldsform, mcs).__new__(mcs, name, bases, classdict)
     
 
-class FieldsForm(FormMixIn):
+class FieldsForm(FormMixIn, AppObject):
     __metaclass__ = metafieldsform
+    __registry__ = 'forms'
+    __select__ = yes()
     
-    def __init__(self, req, domid=None, title=None, action='edit',
-                 onsubmit="return freezeFormButtons('%s');",
+    def __init__(self, req, rset=None, domid=None, title=None, action='edit',
+                 onsubmit="return freezeFormButtons('%(domid)s');",
                  cssclass=None, cssstyle=None, cwtarget=None, buttons=None,
                  redirect_path=None, set_error_url=True, copy_nav_params=False):
         self.req = req
+        self.rset = rset
         self.config = req.vreg.config
         self.domid = domid or 'form'
         self.title = title
@@ -805,6 +809,7 @@
 
    
 class EntityFieldsForm(FieldsForm):
+    __select__ = non_final_entity()
     
     def __init__(self, *args, **kwargs):
         kwargs.setdefault('domid', 'entityForm')