From eef80b9e245ba9045c8682f041724a1306b8c3e9 Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Mon, 16 May 2022 16:01:32 +0200
Subject: [PATCH] ERP5Type: fix regression in properties.dtml

In commit a17bb91030b849d1367db8b3954b81dc830a3ce0 ("py2/py3:
Make Products code compatible with both python2 and python3"),
2to3 changed `_.has_key(...)` to `... in _` whereas _ is not a dict.

Traceback (innermost last):
 ...
 Module OFS.PropertyManager, line 309, in manage_editProperties
   manage_tabs_message=message)
 Module Shared.DC.Scripts.Bindings, line 322, in __call__
   return self._bindAndExec(args, kw, None)
 Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
   return self._exec(bound_data, args, kw)
 Module App.special_dtml, line 185, in _exec
   try: result = render_blocks(self._v_blocks, ns)
 Module DocumentTemplate.DT_In, line 707, in renderwob
   try: append(render(section, md))
 Module DocumentTemplate.DT_Let, line 76, in render
   else: d[name]=expr(md)
 Module DocumentTemplate.DT_Util, line 210, in eval
  - __traceback_info__: _
   return eval(code, d)
 Module <string>, line 1, in <module>

TypeError: argument of type 'TemplateDict' is not iterable
---
 product/ERP5Type/dtml/properties.dtml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/product/ERP5Type/dtml/properties.dtml b/product/ERP5Type/dtml/properties.dtml
index 58533b5622..edaed6913f 100644
--- a/product/ERP5Type/dtml/properties.dtml
+++ b/product/ERP5Type/dtml/properties.dtml
@@ -48,7 +48,7 @@ property values, edit the values and click &quot;Save Changes&quot;.
 </tr>
 
 <dtml-in propertyMap mapping>
-<dtml-let type="'type' not in _ and 'string' or type">
+<dtml-let type="not _.has_key('type') and 'string' or type">
 <tr>
   <td align="left" valign="top" width="16">
   <dtml-if "'d' in _['sequence-item'].get('mode', 'awd')">
@@ -105,7 +105,7 @@ property values, edit the values and click &quot;Save Changes&quot;.
       </dtml-in>
     </select>
     </div>
-    <dtml-elif "'select_variable' in _">
+    <dtml-elif "_.has_key('select_variable')">
     <div class="form-element">
     <select name="&dtml-id;:<dtml-var "REQUEST['management_page_charset_tag']">text">
       <dtml-in "_[select_variable]">
@@ -135,7 +135,7 @@ property values, edit the values and click &quot;Save Changes&quot;.
       </dtml-in>
     </select>
     </div>
-    <dtml-elif "'select_variable' in _">
+    <dtml-elif "_.has_key('select_variable')">
     <div class="form-element">
     <select name="&dtml-id;:<dtml-var "REQUEST['management_page_charset_tag']">list:string" multiple
       size="<dtml-var "_.min(7, _.len(_[select_variable]))">">
-- 
2.30.9