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
Levin Zimmermann
erp5
Commits
9f33e2cd
Commit
9f33e2cd
authored
Jan 19, 2021
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trashTool: add option to not overwrite existing objects when restoring
parent
ad0fbcdf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
product/ERP5/Tool/TrashTool.py
product/ERP5/Tool/TrashTool.py
+5
-1
No files found.
product/ERP5/Tool/TrashTool.py
View file @
9f33e2cd
...
@@ -34,6 +34,7 @@ from Products.ERP5Type.Globals import InitializeClass, DTMLFile
...
@@ -34,6 +34,7 @@ from Products.ERP5Type.Globals import InitializeClass, DTMLFile
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
from
Products.ERP5Type.Tool.BaseTool
import
BaseTool
from
Products.ERP5Type
import
Permissions
from
Products.ERP5Type
import
Permissions
from
Products.ERP5
import
_dtmldir
from
Products.ERP5
import
_dtmldir
from
zExceptions
import
BadRequest
from
zLOG
import
LOG
,
WARNING
from
zLOG
import
LOG
,
WARNING
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
...
@@ -190,7 +191,7 @@ class TrashTool(BaseTool):
...
@@ -190,7 +191,7 @@ class TrashTool(BaseTool):
return
trashbin
return
trashbin
security
.
declarePrivate
(
'restoreObject'
)
security
.
declarePrivate
(
'restoreObject'
)
def
restoreObject
(
self
,
trashbin
,
container_path
,
object_id
):
def
restoreObject
(
self
,
trashbin
,
container_path
,
object_id
,
pass_if_exist
=
True
):
"""
"""
Restore an object from the trash bin (copy it under portal)
Restore an object from the trash bin (copy it under portal)
"""
"""
...
@@ -258,6 +259,9 @@ class TrashTool(BaseTool):
...
@@ -258,6 +259,9 @@ class TrashTool(BaseTool):
# already removed, and we cannot backup the object
# already removed, and we cannot backup the object
LOG
(
"Trash Tool backupObject"
,
WARNING
,
LOG
(
"Trash Tool backupObject"
,
WARNING
,
"Can't backup object %s"
%
object_path
)
"Can't backup object %s"
%
object_path
)
except
BadRequest
:
if
pass_if_exist
:
pass
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getTrashBinObjectsList'
)
security
.
declareProtected
(
Permissions
.
ManagePortal
,
'getTrashBinObjectsList'
)
def
getTrashBinObjectsList
(
self
,
trashbin
):
def
getTrashBinObjectsList
(
self
,
trashbin
):
...
...
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