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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
erp5
Commits
7c085c43
Commit
7c085c43
authored
May 09, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HBTreeFolder2: minor cleanup
parent
5e5a0998
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
product/HBTreeFolder2/HBTreeFolder2.py
product/HBTreeFolder2/HBTreeFolder2.py
+5
-11
No files found.
product/HBTreeFolder2/HBTreeFolder2.py
View file @
7c085c43
...
@@ -24,7 +24,6 @@ from App.special_dtml import DTMLFile
...
@@ -24,7 +24,6 @@ from App.special_dtml import DTMLFile
from
Persistence
import
Persistent
,
PersistentMapping
from
Persistence
import
Persistent
,
PersistentMapping
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
from
BTrees.OOBTree
import
OOBTree
from
BTrees.OOBTree
import
OOBTree
from
BTrees.OIBTree
import
OIBTree
,
union
from
BTrees.Length
import
Length
from
BTrees.Length
import
Length
from
ZODB.POSException
import
ConflictError
from
ZODB.POSException
import
ConflictError
from
OFS.ObjectManager
import
BadRequestException
,
BeforeDeleteException
from
OFS.ObjectManager
import
BadRequestException
,
BeforeDeleteException
...
@@ -180,12 +179,9 @@ class HBTreeFolder2Base (Persistent):
...
@@ -180,12 +179,9 @@ class HBTreeFolder2Base (Persistent):
def
_populateFromFolder
(
self
,
source
):
def
_populateFromFolder
(
self
,
source
):
"""Fill this folder with the contents of another folder.
"""Fill this folder with the contents of another folder.
"""
"""
for
name
in
source
.
objectIds
():
for
name
,
value
in
source
.
objectItems
():
value
=
source
.
_getOb
(
name
,
None
)
if
value
is
not
None
:
self
.
_setOb
(
name
,
aq_base
(
value
))
self
.
_setOb
(
name
,
aq_base
(
value
))
security
.
declareProtected
(
view_management_screens
,
'manage_fixCount'
)
security
.
declareProtected
(
view_management_screens
,
'manage_fixCount'
)
def
manage_fixCount
(
self
,
dry_run
=
0
):
def
manage_fixCount
(
self
,
dry_run
=
0
):
"""Calls self._fixCount() and reports the result as text.
"""Calls self._fixCount() and reports the result as text.
...
@@ -260,7 +256,7 @@ class HBTreeFolder2Base (Persistent):
...
@@ -260,7 +256,7 @@ class HBTreeFolder2Base (Persistent):
error
=
sys
.
exc_info
())
error
=
sys
.
exc_info
())
try
:
try
:
self
.
_htree
=
OOBTree
(
self
.
_htree
)
# XXX hFix needed
self
.
_htree
=
OOBTree
(
self
.
_htree
)
# XXX hFix needed
except
:
except
Exception
:
LOG
(
'HBTreeFolder2'
,
ERROR
,
'Failed to fix %s.'
%
path
,
LOG
(
'HBTreeFolder2'
,
ERROR
,
'Failed to fix %s.'
%
path
,
error
=
sys
.
exc_info
())
error
=
sys
.
exc_info
())
raise
raise
...
@@ -420,7 +416,7 @@ class HBTreeFolder2Base (Persistent):
...
@@ -420,7 +416,7 @@ class HBTreeFolder2Base (Persistent):
h
=
self
.
_htree
h
=
self
.
_htree
recurse_stack
=
[]
recurse_stack
=
[]
try
:
try
:
for
sub_id
in
min
and
self
.
hashId
(
min
)
or
(
''
,):
for
sub_id
in
self
.
hashId
(
min
)
if
min
else
(
''
,):
if
recurse_stack
:
if
recurse_stack
:
i
.
next
()
i
.
next
()
if
type
(
h
)
is
not
OOBTree
:
if
type
(
h
)
is
not
OOBTree
:
...
@@ -492,8 +488,6 @@ class HBTreeFolder2Base (Persistent):
...
@@ -492,8 +488,6 @@ class HBTreeFolder2Base (Persistent):
'objectItems'
)
'objectItems'
)
def
objectItems
(
self
,
base_id
=
_marker
):
def
objectItems
(
self
,
base_id
=
_marker
):
# Returns a list of (id, subobject) tuples of the current object.
# Returns a list of (id, subobject) tuples of the current object.
# If 'spec' is specified, returns only objects whose meta_type match
# 'spec'
return
HBTreeObjectItems
(
self
,
base_id
)
return
HBTreeObjectItems
(
self
,
base_id
)
# superValues() looks for the _objects attribute, but the implementation
# superValues() looks for the _objects attribute, but the implementation
...
@@ -548,7 +542,7 @@ class HBTreeFolder2Base (Persistent):
...
@@ -548,7 +542,7 @@ class HBTreeFolder2Base (Persistent):
raise
raise
except
ConflictError
:
except
ConflictError
:
raise
raise
except
:
except
Exception
:
LOG
(
'Zope'
,
ERROR
,
'manage_beforeDelete() threw'
,
LOG
(
'Zope'
,
ERROR
,
'manage_beforeDelete() threw'
,
error
=
sys
.
exc_info
())
error
=
sys
.
exc_info
())
self
.
_delOb
(
id
)
self
.
_delOb
(
id
)
...
...
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