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
b9bed178
Commit
b9bed178
authored
Sep 18, 1997
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deletable object filters added
parent
1cbeef98
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
33 deletions
+52
-33
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+44
-25
lib/python/OFS/main.dtml
lib/python/OFS/main.dtml
+4
-4
lib/python/OFS/properties.dtml
lib/python/OFS/properties.dtml
+4
-4
No files found.
lib/python/OFS/ObjectManager.py
View file @
b9bed178
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.
9 1997/09/18 20:03:37
brian Exp $"""
$Id: ObjectManager.py,v 1.
10 1997/09/18 22:48:45
brian Exp $"""
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
10
$'
[
11
:
-
2
]
from
SingleThreadedTransaction
import
Persistent
...
...
@@ -82,8 +82,6 @@ class ObjectManager(Acquirer,Management,Persistent):
return
(
self
.
aq_parent
,)
except
:
pass
return
()
#try: return (self.aq_parent,)
#except: return ()
def
_setObject
(
self
,
id
,
object
):
self
.
_checkId
(
id
)
...
...
@@ -94,8 +92,8 @@ class ObjectManager(Acquirer,Management,Persistent):
def
_delObject
(
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
):
# Return a list of subobject ids
if
t
is
not
None
:
...
...
@@ -124,7 +122,34 @@ class ObjectManager(Acquirer,Management,Persistent):
self
.
_objects
))
return
map
(
lambda
i
,
s
=
self
:
(
i
[
'id'
],
getattr
(
s
,
i
[
'id'
])),
self
.
_objects
)
def
objectMap
(
self
):
# Return a tuple of mappings containing subobject meta-data
return
self
.
_objects
def
objectIds_d
(
self
,
t
=
None
):
v
=
self
.
objectIds
(
t
)
try
:
n
=
self
.
_reserved_names
except
:
return
v
return
filter
(
lambda
x
,
r
=
n
:
x
not
in
r
,
v
)
def
objectValues_d
(
self
,
t
=
None
):
v
=
self
.
objectIds
(
t
)
try
:
n
=
self
.
_reserved_names
except
:
return
map
(
lambda
i
,
s
=
self
:
getattr
(
s
,
i
),
v
)
return
map
(
lambda
i
,
s
=
self
:
getattr
(
s
,
i
),
filter
(
lambda
x
,
r
=
n
:
x
not
in
r
,
v
))
def
objectItems_d
(
self
,
t
=
None
):
v
=
self
.
objectItems
(
t
)
try
:
n
=
self
.
_reserved_names
except
:
return
v
return
filter
(
lambda
x
,
r
=
n
:
x
[
0
]
not
in
r
,
v
)
def
objectMap_d
(
self
,
t
=
None
):
v
=
self
.
_objects
try
:
n
=
self
.
_reserved_names
except
:
return
v
return
filter
(
lambda
x
,
r
=
n
:
x
[
'id'
]
not
in
r
,
v
)
def
superIds
(
self
,
t
):
if
type
(
t
)
==
type
(
's'
):
t
=
(
t
,)
...
...
@@ -212,21 +237,6 @@ class ObjectManager(Acquirer,Management,Persistent):
x
=
x
+
1
return
vals
def
objectMap
(
self
):
# Return a tuple of mappings containing subobject meta-data
return
self
.
_objects
def
manage_addObject
(
self
,
type
,
REQUEST
):
"""Add a subordinate object"""
for
t
in
self
.
meta_types
:
...
...
@@ -239,8 +249,8 @@ class ObjectManager(Acquirer,Management,Persistent):
def
manage_delObjects
(
self
,
ids
,
REQUEST
):
"""Delete a subordinate object"""
try
:
p
=
map
(
lambda
d
:
d
[
'id'
],
self
.
__class__
.
_objects
)
except
:
p
=
[]
try
:
p
=
self
.
_reserved_names
except
:
p
=
()
for
n
in
ids
:
if
n
in
p
:
return
MessageDialog
(
title
=
'Not Deletable'
%
n
,
...
...
@@ -277,6 +287,12 @@ class ObjectManager(Acquirer,Management,Persistent):
# Return a tuple of mappings, giving meta-data for properties
return
self
.
_properties
def
propertyMap_d
(
self
):
v
=
self
.
_properties
try
:
n
=
self
.
_reserved_names
except
:
return
v
return
filter
(
lambda
x
,
r
=
n
:
x
[
'id'
]
not
in
r
,
v
)
def
manage_addProperty
(
self
,
id
,
value
,
type
,
REQUEST
):
"""Add a new property (www)"""
self
.
_setProperty
(
id
,
value
,
type
)
...
...
@@ -292,8 +308,8 @@ class ObjectManager(Acquirer,Management,Persistent):
def
manage_delProperties
(
self
,
ids
,
REQUEST
):
"""Delete one or more properties"""
try
:
p
=
map
(
lambda
d
:
d
[
'id'
],
self
.
__class__
.
_properties
)
except
:
p
=
[]
try
:
p
=
self
.
_reserved_names
except
:
p
=
()
for
n
in
ids
:
if
n
in
p
:
return
MessageDialog
(
...
...
@@ -375,6 +391,9 @@ class ObjectManager(Acquirer,Management,Persistent):
##############################################################################
#
# $Log: ObjectManager.py,v $
# Revision 1.10 1997/09/18 22:48:45 brian
# Deletable object filters added
#
# Revision 1.9 1997/09/18 20:03:37 brian
# Added superX type sniffer
#
...
...
lib/python/OFS/main.dtml
View file @
b9bed178
...
...
@@ -46,7 +46,7 @@ To add a new item, select an item type and click "Add".
</FORM>
</TD>
</TR>
<!--#if objectValues-->
<!--#if objectValues
_d
-->
<TR>
<TD VALIGN="TOP">
To delete items, select one or more items and click "Delete".
...
...
@@ -54,15 +54,15 @@ To delete items, select one or more items and click "Delete".
<TD VALIGN="TOP">
<FORM ACTION="<!--#var PARENT_URL-->/manage_delObjects" METHOD="GET">
<SELECT NAME="ids:list" MULTIPLE SIZE="4">
<!--#in objectValues-->
<!--#in objectValues
_d
-->
<OPTION VALUE="<!--#var id-->"><!--#var title_and_id-->
<!--#/in objectValues-->
<!--#/in objectValues
_d
-->
</SELECT><BR>
<INPUT TYPE="SUBMIT" VALUE="Delete">
</FORM>
</TD>
</TR>
<!--#/if objectValues-->
<!--#/if objectValues
_d
-->
</TABLE>
</BODY>
</HTML>
lib/python/OFS/properties.dtml
View file @
b9bed178
...
...
@@ -79,7 +79,7 @@ property below and click "Add".
</TABLE>
</FORM>
<!--#if propertyMap-->
<!--#if propertyMap
_d
-->
<P>
<FORM ACTION="<!--#var URL1-->/manage_delProperties" METHOD="POST">
To delete properties, select one or more property ids
...
...
@@ -89,9 +89,9 @@ from the list below and click "Delete".
<TR>
<TD ALIGN="LEFT" VALIGN="TOP">
<SELECT NAME="ids:list" SIZE="5" MULTIPLE>
<!--#in propertyMap mapping-->
<!--#in propertyMap
_d
mapping-->
<OPTION VALUE="<!--#var id-->"><!--#var id fmt=nicify-->
<!--#/in propertyMap-->
<!--#/in propertyMap
_d
-->
</SELECT>
<BR>
<INPUT TYPE="SUBMIT" VALUE="Delete">
...
...
@@ -99,7 +99,7 @@ from the list below and click "Delete".
</TR>
</TABLE>
</FORM>
<!--#/if propertyMap-->
<!--#/if propertyMap
_d
-->
</BODY>
</HTML>
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