diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py
index b71d5768b2767be1a8048f984620d3df5f1fdbc5..eaf630c2a8c551a76d8a1a6f10e5ca31a241ae89 100644
--- a/product/ERP5Form/ListBox.py
+++ b/product/ERP5Form/ListBox.py
@@ -38,12 +38,11 @@ from SelectionTool import createFolderMixInPageSelectionMethod
 from Products.ERP5Type.Utils import getPath
 from Products.ERP5Type.Document import newTempBase
 from Products.CMFCore.utils import getToolByName
-from Products.CMFCore.utils import _checkPermission
 from Products.ZSQLCatalog.zsqlbrain import ZSQLBrain
 from Products.ERP5Type.Message import Message
 
 from Acquisition import aq_base, aq_self
-from zLOG import LOG, WARNING
+from zLOG import LOG, WARNING, INFO
 from ZODB.POSException import ConflictError
 
 from Globals import InitializeClass, Acquisition, get_request
@@ -52,7 +51,7 @@ from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 
 import md5
 import cgi
-import types
+from traceback import extract_stack
 
 # For compatibility with Python 2.3.
 try:
@@ -60,7 +59,6 @@ try:
 except NameError:
   from sets import Set as set
 
-
 class ObjectValuesWrapper:
   """This class wraps objectValues so that objectValues behaves like portal_catalog.
   """
@@ -422,7 +420,7 @@ class ListBoxRenderer:
   def getPhysicalPath(self):
     """
       Return the path of form we render.
-      This function is required to be able to use ZopeProfiler product with 
+      This function is required to be able to use ZopeProfiler product with
       listbox.
     """
     return self.field.getPhysicalPath()
@@ -985,7 +983,7 @@ class ListBoxRenderer:
     # objects in the current ListBox configuration.
     if 'select_expression' in params:
       del params['select_expression']
-    
+
     self.getSelection().edit(params=params)
     return params
 
@@ -1395,7 +1393,7 @@ class ListBoxRenderer:
         else:
           original_value = stat_method
           processed_value = original_value
-      
+
       editable_field = self.getEditableField(alias)
       if editable_field is not None:
         processed_value = editable_field.render_view(value=original_value)
@@ -1770,7 +1768,6 @@ class ListBoxRendererLine:
       if context is not None:
         return context.getTitleOrId() or ''
     return ''
-        
 
   def getDepth(self):
     """Return the depth of a domain. Used only for a summary line.
@@ -1857,7 +1854,7 @@ class ListBoxRendererLine:
             original_value = editable_field.__of__(obj).get_value('default',
                                                         cell=brain)
             processed_value = original_value
-        
+
         # If a tales expression is not defined, get a skin, an accessor or a property.
         if not tales:
           if hasattr(aq_self(brain), alias):
@@ -2035,7 +2032,7 @@ class ListBoxHTMLRendererLine(ListBoxRendererLine):
           error_text = error_dict[key].error_text
           error_text = cgi.escape(error_text)
           if isinstance(error_text, str):
-            error_text = u'%s' % Message(domain=ui_domain, 
+            error_text = u'%s' % Message(domain=ui_domain,
                                          message=error_text)
           error_message = u'<br />' + error_text
         else:
@@ -2841,12 +2838,11 @@ class ListBoxValidator(Validator.Validator):
         selection_name = field.get_value('selection_name')
         #LOG('ListBoxValidator', 0, 'field = %s, selection_name = %s' % (repr(field), repr(selection_name)))
         params = here.portal_selections.getSelectionParamsFor(
-                                                           selection_name, 
+                                                           selection_name,
                                                            REQUEST=REQUEST)
         portal_url = getToolByName(here, 'portal_url')
         portal = portal_url.getPortalObject()
 
-
         result = {}
         error_result = {}
         MARKER = []
@@ -3052,7 +3048,6 @@ class ListBox(ZMIField):
       name = list_method
     return name or None
 
-
 class ListBoxLine:
   meta_type = "ListBoxLine"
   security = ClassSecurityInfo()
@@ -3240,7 +3235,6 @@ class ListBoxLine:
     """
     self.is_section_folded = is_section_folded
 
-
   security.declarePublic('isSectionFolded')
   def isSectionFolded(self):
     """
@@ -3278,7 +3272,6 @@ class ListBoxLine:
     else:
       config_column = [self.config_dict[column_id] for column_id in self.config_display_list]
 
-
     return config_column + [self.column_dict[column_id] for column_id in column_id_list]
 
   security.declarePublic('getColumnItemList')
diff --git a/product/ERP5Form/SelectionTool.py b/product/ERP5Form/SelectionTool.py
index 71a4fd0ba838beb19be68c1ecaf76f82cc5f2b5a..852434306a41570f2e707682d15fa93fc33484b4 100644
--- a/product/ERP5Form/SelectionTool.py
+++ b/product/ERP5Form/SelectionTool.py
@@ -30,29 +30,19 @@
   ERP5 portal_selection tool.
 """
 
-from OFS.Traversable import NotFound
 from OFS.SimpleItem import SimpleItem
 from Products.CMFCore.utils import UniqueObject
 from Globals import InitializeClass, DTMLFile, PersistentMapping, get_request
-from ZTUtils import make_query
 from AccessControl import ClassSecurityInfo
 from Products.ERP5Type.Tool.BaseTool import BaseTool
 from Products.ERP5Type import Permissions as ERP5Permissions
 from Products.ERP5Form import _dtmldir
 from Selection import Selection, DomainSelection
 from ZPublisher.HTTPRequest import FileUpload
-from email.MIMEBase import MIMEBase
-from email import Encoders
-from copy import copy
-from DateTime import DateTime
 import md5
-import pickle
-import hmac
-import random
-import re
 import string
-from zLOG import LOG, WARNING, INFO
-from Acquisition import Implicit, aq_base
+from zLOG import LOG, INFO
+from Acquisition import aq_base
 from Products.ERP5Type.Message import Message
 import warnings
 
@@ -726,7 +716,7 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
         params = selection.getParams()
         zoom_start = request.form.get('zoom_start',0)
         params['zoom_start'] = zoom_start
-        selection.edit(params= params)
+        selection.edit(params=params)
       if REQUEST is not None:
         return self._redirectToOriginalForm(REQUEST=REQUEST, form_id=form_id,
                                            query_string=query_string)
@@ -794,7 +784,7 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
         return self._redirectToOriginalForm(REQUEST=REQUEST,
                                             form_id=form_id,
                                              query_string=query_string)
-    
+
     security.declareProtected(ERP5Permissions.View, 'setDomainRoot')
     def setDomainRoot(self, REQUEST, form_id=None, query_string=None):
       """
@@ -963,7 +953,7 @@ class SelectionTool( BaseTool, UniqueObject, SimpleItem ):
       # It is better to reset the query when changing the display mode.
       params = selection.getParams()
       if 'where_expression' in params: del params['where_expression']
-      selection.edit(params = params)
+      selection.edit(params=params)
 
       if redirect:
         return self._redirectToOriginalForm(REQUEST=request, form_id=form_id,