diff --git a/product/ERP5Catalog/CatalogTool.py b/product/ERP5Catalog/CatalogTool.py index ea38513390420fcda0cdf16066a716dbf53a78af..fa8155ab8b58ecac619ee3703da019f9bc2d45fa 100644 --- a/product/ERP5Catalog/CatalogTool.py +++ b/product/ERP5Catalog/CatalogTool.py @@ -26,40 +26,29 @@ # ############################################################################## -from ZODB.POSException import ConflictError from Products.CMFCore.CatalogTool import CatalogTool as CMFCoreCatalogTool from Products.ZSQLCatalog.ZSQLCatalog import ZCatalog from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery from Products.ERP5Type import Permissions -from Products.ERP5Type.Cache import CachingMethod from AccessControl import ClassSecurityInfo, getSecurityManager -from Products.CMFCore.utils import UniqueObject, _checkPermission, _getAuthenticatedUser, getToolByName -from Products.ERP5Type.Globals import InitializeClass, DTMLFile, package_home +from Products.CMFCore.utils import UniqueObject, _getAuthenticatedUser, getToolByName +from Products.ERP5Type.Globals import InitializeClass, DTMLFile from Acquisition import aq_base, aq_inner, aq_parent, ImplicitAcquisitionWrapper -from DateTime.DateTime import DateTime from Products.CMFActivity.ActiveObject import ActiveObject from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from AccessControl.PermissionRole import rolesForPermissionOn -from Products.PageTemplates.Expressions import SecureModuleImporter -from Products.CMFCore.Expression import Expression -from Products.PageTemplates.Expressions import getEngine from MethodObject import Method from Products.ERP5Security import mergedLocalRoles from Products.ERP5Security.ERP5UserManager import SUPER_USER from Products.ERP5Type.Utils import sqlquote -import os, urllib, warnings -import sys +import warnings from zLOG import LOG, PROBLEM, WARNING, INFO ACQUIRE_PERMISSION_VALUE = [] - -from Persistence import Persistent -from Acquisition import Implicit - DYNAMIC_METHOD_NAME = 'z_related_' DYNAMIC_METHOD_NAME_LEN = len(DYNAMIC_METHOD_NAME) STRICT_DYNAMIC_METHOD_NAME = DYNAMIC_METHOD_NAME + 'strict_' @@ -254,7 +243,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): default_result_limit = None default_count_limit = 1 - + manage_options = ({ 'label' : 'Overview', 'action' : 'manage_overview' }, ) + ZCatalog.manage_options @@ -396,7 +385,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): a parameter named local_roles so that listed documents only include those documents for which the user (or the group) was associated one of the given local roles. - + The use of getAllowedRolesAndUsers is deprecated, you should use getSecurityQuery instead """ @@ -539,7 +528,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): elif security_uid_list: query = Query(security_uid=security_uid_list, operator='IN') else: - # XXX A false query has to be generated. + # XXX A false query has to be generated. # As it is not possible to use SQLKey for now, pass impossible value # on uid (which will be detected as False by MySQL, as it is not in the # column range) @@ -630,12 +619,12 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): # now = DateTime() # #kw[ 'effective' ] = { 'query' : now, 'range' : 'max' } # #kw[ 'expires' ] = { 'query' : now, 'range' : 'min' } - catalog_id = self.getPreferredSQLCatalogId(kw.pop("sql_catalog_id", None)) + catalog_id = self.getPreferredSQLCatalogId(kw.pop("sql_catalog_id", None)) query = self.getSecurityQuery(query=query, sql_catalog_id=catalog_id, **kw) kw.setdefault('limit', self.default_count_limit) # get catalog from preference return ZCatalog.countResults(self, query=query, sql_catalog_id=catalog_id, **kw) - + security.declarePrivate('unrestrictedCountResults') def unrestrictedCountResults(self, REQUEST=None, **kw): """Calls ZSQLCatalog.countResults directly without restrictions. @@ -662,7 +651,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): # Find the parent definition for security is_acquired = 0 while getattr(document_object, 'isRADContent', 0): - # This condition tells which object should acquire + # This condition tells which object should acquire # from their parent. # XXX Hardcode _View_Permission for a performance point of view if getattr(aq_base(document_object), '_View_Permission', ACQUIRE_PERMISSION_VALUE) == ACQUIRE_PERMISSION_VALUE\