Commit dbe62ac7 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

py2/py3: explicitly cast to list for dict.keys() or dict.items() + list.

parent 1365b62a
...@@ -17,6 +17,7 @@ import Acquisition ...@@ -17,6 +17,7 @@ import Acquisition
import astor import astor
import importlib import importlib
from erp5.component.module.Log import log from erp5.component.module.Log import log
from Products.ERP5Type.Utils import ensure_list
# Display matplotlib figure automatically like # Display matplotlib figure automatically like
# the original python kernel # the original python kernel
...@@ -495,7 +496,7 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context): ...@@ -495,7 +496,7 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context):
# Saves a list of all the variables we injected into the user context and # Saves a list of all the variables we injected into the user context and
# shall be deleted before saving the context. # shall be deleted before saving the context.
volatile_variable_list = current_setup_dict.keys() + inject_variable_dict.keys() + user_context.get('_volatile_variable_list', []) volatile_variable_list = ensure_list(current_setup_dict.keys()) + ensure_list(inject_variable_dict.keys()) + user_context.get('_volatile_variable_list', [])
volatile_variable_list.append('__builtins__') volatile_variable_list.append('__builtins__')
for key, val in user_context.items(): for key, val in user_context.items():
......
from Products.ERP5Type.Utils import ensure_list
new_request = {} new_request = {}
for k, v in request.other.items() + request.form.items(): for k, v in ensure_list(request.other.items()) + ensure_list(request.form.items()):
if k not in ('TraversalRequestNameStack', 'AUTHENTICATED_USER', 'URL', if k not in ('TraversalRequestNameStack', 'AUTHENTICATED_USER', 'URL',
'SERVER_URL', 'AUTHENTICATION_PATH', 'USER_PREF_LANGUAGES', 'PARENTS', 'SERVER_URL', 'AUTHENTICATION_PATH', 'USER_PREF_LANGUAGES', 'PARENTS',
'PUBLISHED', 'AcceptLanguage', 'AcceptCharset', 'RESPONSE', 'SESSION', 'PUBLISHED', 'AcceptLanguage', 'AcceptCharset', 'RESPONSE', 'SESSION',
......
...@@ -9,6 +9,7 @@ It will also not work if strict security is set on simulation. It's recommended ...@@ -9,6 +9,7 @@ It will also not work if strict security is set on simulation. It's recommended
delivery builder. delivery builder.
""" """
from erp5.component.module.Log import log from erp5.component.module.Log import log
from Products.ERP5Type.Utils import ensure_list
LOG = lambda msg:log( LOG = lambda msg:log(
"Delivery_setCausalityFromSimulation on %s" % context.getPath(), msg) "Delivery_setCausalityFromSimulation on %s" % context.getPath(), msg)
LOG = lambda msg:'DISABLED' LOG = lambda msg:'DISABLED'
...@@ -36,4 +37,4 @@ for simulation_movement in simulation_movement_list : ...@@ -36,4 +37,4 @@ for simulation_movement in simulation_movement_list :
causality_value_set[explanation_value] = 1 causality_value_set[explanation_value] = 1
LOG('setCausalityValueList %s'%causality_value_set.keys()) LOG('setCausalityValueList %s'%causality_value_set.keys())
delivery.setCausalityValueList(causality_value_set.keys() + delivery.getCausalityValueList()) delivery.setCausalityValueList(ensure_list(causality_value_set.keys()) + ensure_list(delivery.getCausalityValueList()))
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<dtml-if quantity_unit_conversion_dict> <dtml-if quantity_unit_conversion_dict>
DELETE FROM `quantity_unit_conversion` WHERE DELETE FROM `quantity_unit_conversion` WHERE
<dtml-sqltest "quantity_unit_conversion_dict.keys()" column="resource_uid" type="int" multiple> <dtml-sqltest expr="set(quantity_unit_conversion_dict.keys())" column="resource_uid" type="int" multiple>
<dtml-var sql_delimiter> <dtml-var sql_delimiter>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment