Fix patches, break in test mode
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 13 Oct 2016 18:03:16 +0200
changeset 1836 86da8574b021
parent 1835 fa0a0bb2da4b
child 1837 acdeecc5ef3c
Fix patches, break in test mode It seems that in test mode, monkey patch is done after cubicweb.web.views.forms has been loaded, which hence references the original guess_field (monkey-patched by cube'site_cubicweb). Using the proper module fixes the problem.
views/patches.py
--- a/views/patches.py	Thu Oct 13 18:01:50 2016 +0200
+++ b/views/patches.py	Thu Oct 13 18:03:16 2016 +0200
@@ -38,6 +38,7 @@
 # (https://www.cubicweb.org/ticket/14474840)
 # other part in site_cubicweb
 
+from cubicweb.web import formfields  # noqa
 from cubicweb.web.views import forms  # noqa
 
 
@@ -70,7 +71,7 @@
             req = None
         else:
             req = cls_or_self._cw
-        field = forms.guess_field(eschema, rschema, role, req=req, eidparam=True, **kwargs)
+        field = formfields.guess_field(eschema, rschema, role, req=req, eidparam=True, **kwargs)
         if field is None:
             raise
         return field