Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Kirill Smelkov
Zope
Commits
6a67376b
Commit
6a67376b
authored
Jul 20, 2012
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fixed handling of unicode ids
- related cleanup
parent
301616ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
12 deletions
+28
-12
src/OFS/ObjectManager.py
src/OFS/ObjectManager.py
+12
-10
src/OFS/tests/testObjectManager.py
src/OFS/tests/testObjectManager.py
+16
-2
No files found.
src/OFS/ObjectManager.py
View file @
6a67376b
...
...
@@ -501,34 +501,36 @@ class ObjectManager(CopyContainer,
The objects specified in 'ids' get deleted.
"""
if
type
(
ids
)
is
type
(
''
):
ids
=
[
ids
]
if
isinstance
(
ids
,
basestring
):
ids
=
[
ids
]
if
not
ids
:
return
MessageDialog
(
title
=
'No items specified'
,
message
=
'No items were specified!'
,
action
=
'./manage_main'
,)
try
:
p
=
self
.
_reserved_names
except
:
p
=
()
action
=
'./manage_main'
,)
try
:
p
=
self
.
_reserved_names
except
:
p
=
()
for
n
in
ids
:
if
n
in
p
:
return
MessageDialog
(
title
=
'Not Deletable'
,
message
=
'<EM>%s</EM> cannot be deleted.'
%
escape
(
n
),
action
=
'./manage_main'
,)
action
=
'./manage_main'
,)
while
ids
:
id
=
ids
[
-
1
]
v
=
self
.
_getOb
(
id
,
self
)
id
=
ids
[
-
1
]
v
=
self
.
_getOb
(
id
,
self
)
if
v
.
wl_isLocked
():
raise
ResourceLockedError
,
(
raise
ResourceLockedError
(
'Object "%s" is locked via WebDAV'
%
v
.
getId
())
if
v
is
self
:
raise
BadRequest
,
'%s does not exist'
%
escape
(
ids
[
-
1
]
)
raise
BadRequest
(
'%s does not exist'
%
escape
(
ids
[
-
1
])
)
self
.
_delObject
(
id
)
del
ids
[
-
1
]
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
def
tpValues
(
self
):
# Return a list of subobjects, used by tree tag.
r
=
[]
...
...
src/OFS/tests/testObjectManager.py
View file @
6a67376b
...
...
@@ -6,7 +6,6 @@ from AccessControl.SecurityManagement import noSecurityManager
from
AccessControl.SecurityManager
import
setSecurityPolicy
from
AccessControl.SpecialUsers
import
emergency_user
,
nobody
,
system
from
AccessControl.User
import
User
# before SpecialUsers
from
Acquisition
import
aq_base
from
Acquisition
import
Implicit
from
App.config
import
getConfiguration
from
logging
import
getLogger
...
...
@@ -258,7 +257,7 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
om
.
_delObject
(
ob
.
getId
())
finally
:
logger
.
disabled
=
0
def
test_delObject_exception_debug_manager
(
self
):
# Test exception behavior in manage_beforeDelete in debug mode
# Manager user
...
...
@@ -303,6 +302,21 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
finally
:
logger
.
disabled
=
0
def
test_manage_delObjects
(
self
):
om
=
self
.
_makeOne
()
ob
=
ItemForDeletion
()
om
.
_setObject
(
'stuff'
,
ob
)
om
.
manage_delObjects
(
'stuff'
)
self
.
assertFalse
(
'stuff'
in
om
)
om
.
_setObject
(
'stuff'
,
ob
)
om
.
manage_delObjects
([
'stuff'
])
self
.
assertFalse
(
'stuff'
in
om
)
om
.
_setObject
(
'stuff'
,
ob
)
om
.
manage_delObjects
(
u'stuff'
)
self
.
assertFalse
(
'stuff'
in
om
)
def
test_hasObject
(
self
):
om
=
self
.
_makeOne
()
self
.
assertFalse
(
om
.
hasObject
(
'_properties'
))
...
...
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