[reledit] don't try to use rel-edit on attributes without assicated fields (e.g _format field)
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Tue, 04 Aug 2009 11:36:47 +0200
changeset 2672 c66f52d44394
parent 2671 ee5538bdf0ea
child 2674 ff6114c2c416
[reledit] don't try to use rel-edit on attributes without assicated fields (e.g _format field)
web/views/editforms.py
--- a/web/views/editforms.py	Tue Aug 04 11:35:57 2009 +0200
+++ b/web/views/editforms.py	Tue Aug 04 11:36:47 2009 +0200
@@ -21,7 +21,7 @@
 from cubicweb.view import EntityView
 from cubicweb.common import tags
 from cubicweb.web import INTERNAL_FIELD_VALUE, stdmsgs, eid_param, uicfg
-from cubicweb.web.form import FormViewMixIn
+from cubicweb.web.form import FormViewMixIn, FieldNotFound
 from cubicweb.web.formfields import guess_field
 from cubicweb.web.formwidgets import Button, SubmitButton, ResetButton
 from cubicweb.web.views import forms
@@ -249,6 +249,11 @@
                                 domid='%s-form' % divid, action='#',
                                 cssstyle='display: none',
                                 onsubmit=onsubmit % event_data)
+        try:
+            field = form.field_by_name(rtype, role)
+        except FieldNotFound:
+            self.w(value)
+            return
         w = self.w
         w(u'<div class="field">')
         w(u'<div id="%s" style="display: inline">' % divid)