Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
30470464
Commit
30470464
authored
Jul 08, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TrashTool: fix removal of broken objects from a BTreeFolder2
parent
439cd479
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
product/ERP5/Tool/TrashTool.py
product/ERP5/Tool/TrashTool.py
+9
-4
No files found.
product/ERP5/Tool/TrashTool.py
View file @
30470464
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#
#
##############################################################################
##############################################################################
import
imp
,
re
,
sys
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
from
ZODB.broken
import
Broken
from
ZODB.broken
import
Broken
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
...
@@ -94,11 +94,16 @@ class TrashTool(BaseTool):
...
@@ -94,11 +94,16 @@ class TrashTool(BaseTool):
"Trying to backup uncommitted object %s"
%
object_path
)
"Trying to backup uncommitted object %s"
%
object_path
)
return
{}
return
{}
if
isinstance
(
obj
,
Broken
):
if
isinstance
(
obj
,
Broken
):
# Workaround for bug in ExportImport._importDuringCommit
# (ZODB.serialize should be reused in order
# to use appropriate class factory)
LOG
(
"Trash Tool backupObject"
,
WARNING
,
LOG
(
"Trash Tool backupObject"
,
WARNING
,
"Can't backup broken object %s"
%
object_path
)
"Can't backup broken object %s"
%
object_path
)
klass
=
obj
.
__class__
if
klass
.
__module__
[:
27
]
in
(
'Products.ERP5Type.Document.'
,
'erp5.portal_type'
):
# meta_type is required so that a broken object
# can be removed properly from a BTreeFolder2
# (unfortunately, we can only guess it)
klass
.
meta_type
=
'ERP5'
+
re
.
subn
(
'(?=[A-Z])'
,
' '
,
klass
.
__name__
)[
0
]
return
{}
return
{}
copy
=
connection
.
exportFile
(
obj
.
_p_oid
)
copy
=
connection
.
exportFile
(
obj
.
_p_oid
)
# import object in trash
# import object in trash
...
...
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