don't give a bool instead of a result set to select a view
authorSylvain Thenault <sylvain.thenault@logilab.fr>
Fri, 19 Dec 2008 17:03:15 +0100
changeset 240 6ba006fb95d1
parent 239 5b58fd1aba50
child 241 89e11cc865b2
child 245 716f178f2936
don't give a bool instead of a result set to select a view
web/views/baseforms.py
--- a/web/views/baseforms.py	Fri Dec 19 15:44:11 2008 +0100
+++ b/web/views/baseforms.py	Fri Dec 19 17:03:15 2008 +0100
@@ -460,10 +460,11 @@
             if self.should_inline_relation_form(entity, rschema, targettype, x):
                 result.append(u'<div id="inline%sslot">' % rschema)
                 existant = entity.has_eid() and entity.related(rschema)
-                # display inline-edition view for all existing related entities
-                result.append(self.view('inline-edition', existant, 'null',
-                                        ptype=entity.e_schema, peid=entity.eid,
-                                        rtype=rschema, role=x, **kwargs))
+                if existant:
+                    # display inline-edition view for all existing related entities
+                    result.append(self.view('inline-edition', existant, 
+                                            ptype=entity.e_schema, peid=entity.eid,
+                                            rtype=rschema, role=x, **kwargs))
                 if x == 'subject':
                     card = rschema.rproperty(entity.e_schema, targettype, 'cardinality')[0]
                 else: