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
4412eb89
Commit
4412eb89
authored
Mar 18, 1998
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug that required objects to have a __len__ when a specifier was
given to objectValues, Ids, and Items.
parent
33eb7c50
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
21 deletions
+34
-21
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+34
-21
No files found.
lib/python/OFS/ObjectManager.py
View file @
4412eb89
__doc__
=
"""Object Manager
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.3
6 1998/03/09 19:58:20 jim
Exp $"""
$Id: ObjectManager.py,v 1.3
7 1998/03/18 17:54:29 brian
Exp $"""
__version__
=
'$Revision: 1.3
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
7
$'
[
11
:
-
2
]
import
Persistence
,
App
.
Management
,
Acquisition
,
App
.
Undo
,
Globals
import
Persistence
,
App
.
Management
,
Acquisition
,
App
.
Undo
,
Globals
from
Globals
import
HTMLFile
,
HTMLFile
from
Globals
import
HTMLFile
,
HTMLFile
...
@@ -111,32 +111,39 @@ class ObjectManager(
...
@@ -111,32 +111,39 @@ class ObjectManager(
delattr
(
self
,
id
)
delattr
(
self
,
id
)
self
.
_objects
=
tuple
(
filter
(
lambda
i
,
n
=
id
:
i
[
'id'
]
!=
n
,
self
.
_objects
))
self
.
_objects
=
tuple
(
filter
(
lambda
i
,
n
=
id
:
i
[
'id'
]
!=
n
,
self
.
_objects
))
def
objectIds
(
self
,
t
=
None
):
def
objectIds
(
self
,
spec
=
None
):
# Return a list of subobject ids
# Return a list of subobject ids
if
t
is
not
None
:
if
spec
is
not
None
:
if
type
(
t
)
==
type
(
's'
):
t
=
(
t
,)
if
type
(
spec
)
==
type
(
's'
):
return
filter
(
None
,
map
(
lambda
x
,
v
=
t
:
spec
=
[
spec
]
(
x
[
'meta_type'
]
in
v
)
and
x
[
'id'
]
or
None
,
set
=
[]
self
.
_objects
))
for
ob
in
self
.
_objects
:
if
ob
[
'meta_type'
]
in
spec
:
set
.
append
(
ob
[
'id'
])
return
set
return
map
(
lambda
i
:
i
[
'id'
],
self
.
_objects
)
return
map
(
lambda
i
:
i
[
'id'
],
self
.
_objects
)
def
objectValues
(
self
,
t
=
None
):
def
objectValues
(
self
,
spec
=
None
):
# Return a list of the actual subobjects
# Return a list of the actual subobjects
if
t
is
not
None
:
if
spec
is
not
None
:
if
type
(
t
)
==
type
(
's'
):
t
=
(
t
,)
if
type
(
spec
)
==
type
(
's'
):
return
filter
(
None
,
map
(
lambda
x
,
v
=
t
,
s
=
self
:
spec
=
[
spec
]
(
x
[
'meta_type'
]
in
v
)
and
getattr
(
s
,
x
[
'id'
])
or
None
,
set
=
[]
self
.
_objects
))
for
ob
in
self
.
_objects
:
if
ob
[
'meta_type'
]
in
spec
:
set
.
append
(
getattr
(
self
,
ob
[
'id'
]))
return
set
return
map
(
lambda
i
,
s
=
self
:
getattr
(
s
,
i
[
'id'
]),
self
.
_objects
)
return
map
(
lambda
i
,
s
=
self
:
getattr
(
s
,
i
[
'id'
]),
self
.
_objects
)
def
objectItems
(
self
,
t
=
None
):
def
objectItems
(
self
,
spec
=
None
):
# Return a list of (id, subobject) tuples
# Return a list of (id, subobject) tuples
if
t
is
not
None
:
if
spec
is
not
None
:
if
type
(
t
)
==
type
(
's'
):
t
=
(
t
,)
if
type
(
spec
)
==
type
(
's'
):
return
filter
(
None
,
map
(
lambda
x
,
v
=
t
,
s
=
self
:
spec
=
[
spec
]
(
x
[
'meta_type'
]
in
v
)
and
\
set
=
[]
(
x
[
'id'
],
getattr
(
s
,
x
[
'id'
]))
or
None
,
for
ob
in
self
.
_objects
:
self
.
_objects
))
if
ob
[
'meta_type'
]
in
spec
:
set
.
append
((
ob
[
'id'
],
getattr
(
self
,
ob
[
'id'
])))
return
map
(
lambda
i
,
s
=
self
:
(
i
[
'id'
],
getattr
(
s
,
i
[
'id'
])),
return
map
(
lambda
i
,
s
=
self
:
(
i
[
'id'
],
getattr
(
s
,
i
[
'id'
])),
self
.
_objects
)
self
.
_objects
)
def
objectMap
(
self
):
def
objectMap
(
self
):
...
@@ -269,6 +276,7 @@ class ObjectManager(
...
@@ -269,6 +276,7 @@ class ObjectManager(
aclEChecked
=
''
,
aclAChecked
=
' CHECKED'
,
aclPChecked
=
''
)
aclEChecked
=
''
,
aclAChecked
=
' CHECKED'
,
aclPChecked
=
''
)
raise
'BadRequest'
,
'Unknown object type: %s'
%
type
raise
'BadRequest'
,
'Unknown object type: %s'
%
type
def
manage_delObjects
(
self
,
ids
=
[],
submit
=
''
,
clip_id
=
''
,
def
manage_delObjects
(
self
,
ids
=
[],
submit
=
''
,
clip_id
=
''
,
clip_data
=
''
,
REQUEST
=
None
):
clip_data
=
''
,
REQUEST
=
None
):
"""Delete a subordinate object"""
"""Delete a subordinate object"""
...
@@ -306,6 +314,7 @@ class ObjectManager(
...
@@ -306,6 +314,7 @@ class ObjectManager(
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
def
_setProperty
(
self
,
id
,
value
,
type
=
'string'
):
def
_setProperty
(
self
,
id
,
value
,
type
=
'string'
):
self
.
_checkId
(
id
)
self
.
_checkId
(
id
)
self
.
_properties
=
self
.
_properties
+
({
'id'
:
id
,
'type'
:
type
},)
self
.
_properties
=
self
.
_properties
+
({
'id'
:
id
,
'type'
:
type
},)
...
@@ -477,6 +486,10 @@ class ObjectManager(
...
@@ -477,6 +486,10 @@ class ObjectManager(
##############################################################################
##############################################################################
#
#
# $Log: ObjectManager.py,v $
# $Log: ObjectManager.py,v $
# Revision 1.37 1998/03/18 17:54:29 brian
# Fixed bug that required objects to have a __len__ when a specifier was
# given to objectValues, Ids, and Items.
#
# Revision 1.36 1998/03/09 19:58:20 jim
# Revision 1.36 1998/03/09 19:58:20 jim
# changed session marking support
# changed session marking support
#
#
...
...
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