Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard
erp5
Commits
078c4aad
Commit
078c4aad
authored
May 04, 2012
by
Aurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup import & whitespaces
parent
10e63467
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
20 deletions
+9
-20
product/ERP5Catalog/CatalogTool.py
product/ERP5Catalog/CatalogTool.py
+9
-20
No files found.
product/ERP5Catalog/CatalogTool.py
View file @
078c4aad
...
...
@@ -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
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment