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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
8338a9da
Commit
8338a9da
authored
Aug 14, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
ERP5/Extensions: Remove unused Extension untouched for years
See merge request
nexedi/erp5!1244
parents
714520cf
cf879a85
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
136 deletions
+0
-136
product/ERP5/Extensions/CachePageTemplate.py
product/ERP5/Extensions/CachePageTemplate.py
+0
-34
product/ERP5/Extensions/CheckAllPermissions.py
product/ERP5/Extensions/CheckAllPermissions.py
+0
-24
product/ERP5/Extensions/ReindexAll.py
product/ERP5/Extensions/ReindexAll.py
+0
-78
No files found.
product/ERP5/Extensions/CachePageTemplate.py
deleted
100644 → 0
View file @
714520cf
from
Products.ERP5Type.Globals
import
get_request
import
time
from
zLOG
import
LOG
CACHE_DURATION
=
600
cached_template
=
{}
expires_date
=
{}
def
getCachedPageTemplate
(
self
,
id
=
None
,
REQUEST
=
None
):
global
cached_template
global
expires_date
if
id
is
not
None
:
# Get the user id and request
if
not
REQUEST
:
REQUEST
=
get_request
()
user_id
=
self
.
portal_membership
.
getAuthenticatedMember
().
getIdOrUserName
()
key
=
(
user_id
,
id
)
# lookup the cache for time
now
=
time
.
time
()
# if cache exists and time is OK, return cache
expires
=
expires_date
.
get
(
key
,
now
)
if
expires
>
now
:
LOG
(
'CACHED:'
,
0
,
str
(
id
))
return
cached_template
[
key
]
# else recompute cache
method
=
getattr
(
self
,
id
,
None
)
if
method
is
not
None
:
cached_template
[
key
]
=
method
(
REQUEST
=
REQUEST
)
expires_date
[
key
]
=
now
+
CACHE_DURATION
return
cached_template
[
key
]
else
:
return
''
product/ERP5/Extensions/CheckAllPermissions.py
deleted
100644 → 0
View file @
714520cf
def
_checkPermission
(
folder
):
msg
=
''
if
hasattr
(
folder
,
'objectValues'
):
for
child
in
folder
.
objectValues
():
msg
+=
_checkPermission
(
child
)
if
hasattr
(
folder
,
'valid_roles'
):
valid_role_list
=
folder
.
valid_roles
()
manager_index
=
list
(
valid_role_list
).
index
(
'Manager'
)
permission_list
=
folder
.
permission_settings
()
for
permission
in
permission_list
:
if
permission
[
'acquire'
]
==
''
:
for
role
in
permission
[
'roles'
]:
name
=
role
[
'name'
]
pos
=
name
.
find
(
'r'
)
index
=
int
(
name
[
pos
+
1
:])
if
manager_index
==
index
:
if
role
[
'checked'
]
==
''
:
msg
+=
'%s: %s does not contain Manager
\
n
'
%
(
folder
.
getUrl
(),
permission
[
'name'
])
break
return
msg
def
ERP5Site_checkAllPermissions
(
self
):
portal
=
self
.
portal_url
.
getPortalObject
()
return
_checkPermission
(
portal
)
product/ERP5/Extensions/ReindexAll.py
deleted
100644 → 0
View file @
714520cf
##############################################################################
#
# Copyright (c) 2003 Nexedi SARL and Contributors. All Rights Reserved.
# Sebastien Robin <seb@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
#
# This program as such is not intended to be used by end users. End
# users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the Zope Public License (ZPL) Version 2.0
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
##############################################################################
from
Acquisition
import
aq_base
def
filterReindexAll
(
object
=
None
,
request
=
None
,
**
kw
):
return
1
def
testAfterReindexAll
(
object
=
None
,
request
=
None
,
**
kw
):
result
=
[]
try
:
result
.
append
((
object
.
getRelativeUrl
(),
'portal_type'
,
1
,
object
.
getPortalType
()))
except
:
message
=
'Could not find the portal type'
if
hasattr
(
object
,
'getRelativeUrl'
):
result
.
append
((
object
.
getRelativeUrl
(),
'testAfterReindexAll'
,
101
,
message
))
elif
hasattr
(
object
,
'id'
):
result
.
append
((
object
.
id
,
'testAfterReindexAll'
,
101
,
message
))
else
:
result
.
append
((
'Object with no id'
,
'testAfterReindexAll'
,
101
,
message
))
return
result
def
methodReindexAll
(
object
,
REQUEST
=
None
,
**
kw
):
result
=
[]
try
:
object
.
portal_catalog
.
catalog_object
(
object
,
None
)
#object.reindexObject()
except
:
message
=
'Object could not be catalogued'
if
hasattr
(
object
,
'getRelativeUrl'
):
result
.
append
((
object
.
getRelativeUrl
(),
'methodReindexAll'
,
101
,
message
))
elif
hasattr
(
object
,
'id'
):
result
.
append
((
object
.
id
,
'methodReindexAll'
,
101
,
message
))
else
:
result
.
append
((
'Object with no id'
,
'methodReindexAll'
,
101
,
message
))
return
result
def
reindexAll
(
object
=
None
,
REQUEST
=
None
,
**
kw
):
"""
Folder needs to be updated in order to take into account
changes of classes and in particular meta_type
"""
result
=
[]
container
=
object
obase
=
aq_base
(
container
)
# Call recursiveApply only if this is an ERP5 Folder
if
hasattr
(
obase
,
'recursiveApply'
):
result
+=
container
.
recursiveApply
(
filter
=
filterReindexAll
,
method
=
methodReindexAll
,
test_after
=
testAfterReindexAll
,
REQUEST
=
REQUEST
)
# or if this is a folder, do it on contained objects
elif
hasattr
(
obase
,
'objectValues'
):
for
object
in
container
.
objectValues
():
result
+=
reindexAll
(
object
=
object
,
REQUEST
=
REQUEST
,
**
kw
)
# else reindex
else
:
result
+=
methodReindexAll
(
object
=
container
,
REQUEST
=
REQUEST
,
**
kw
)
return
result
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