[PATCH 2 of 3 3.26] [autoform] Fix display_fields handling

Denis Laxalde denis.laxalde at logilab.fr
Thu Jun 27 12:53:56 CEST 2019

# HG changeset patch
# User Denis Laxalde <denis.laxalde at logilab.fr>
# Date 1561630822 -7200
#      jeu. juin 27 12:20:22 2019 +0200
# Branch 3.26
# Node ID fff386470c834a630e2e7428834ae58815e88545
# Parent  ea89ca9017c43f50e8a2558889f08af60f4314c7
# Available At https://hg.logilab.org/review/cubicweb
#              hg pull https://hg.logilab.org/review/cubicweb -r fff386470c83
[autoform] Fix display_fields handling

This follows-up on changeset b2ceb483e056 (present in 3.25 as well), in
which AutomaticEntityForm.editable_attributes() was turned into a
generator. In this method, in case display_fields is not None, we
previously returned a list of (rtype, role); this was changed into a
yield, but the change was missing a return after the loop in order not
to go through the remainder of the function.

diff --git a/cubicweb/web/views/autoform.py b/cubicweb/web/views/autoform.py
--- a/cubicweb/web/views/autoform.py
+++ b/cubicweb/web/views/autoform.py
@@ -871,6 +871,7 @@ class AutomaticEntityForm(forms.EntityFi
             schema = self._cw.vreg.schema
             for rtype, role in self.display_fields:
                 yield (schema[rtype], role)
+            return
         if self.edited_entity.has_eid() and not self.edited_entity.cw_has_perm('update'):
         action = 'update' if self.edited_entity.has_eid() else 'add'

More information about the cubicweb-devel mailing list