Commit ef1faebb authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

remove needless imports and make cosmetic cleanup.

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