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
af6a9160
Commit
af6a9160
authored
Jan 26, 1998
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added confirmation to property editing
parent
5d4df59c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
40 deletions
+26
-40
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+26
-40
No files found.
lib/python/OFS/ObjectManager.py
View file @
af6a9160
__doc__
=
"""Object Manager
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.3
2 1998/01/22 00:15:01 jim
Exp $"""
$Id: ObjectManager.py,v 1.3
3 1998/01/26 16:33:13 brian
Exp $"""
__version__
=
'$Revision: 1.3
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
3
$'
[
11
:
-
2
]
import
Persistence
,
App
.
Management
,
Acquisition
,
App
.
Undo
,
sys
import
Persistence
,
App
.
Management
,
Acquisition
,
App
.
Undo
from
Globals
import
HTMLFile
,
HTMLFile
from
Globals
import
HTMLFile
,
HTMLFile
from
Globals
import
MessageDialog
,
default__class_init__
from
Globals
import
MessageDialog
,
default__class_init__
from
string
import
find
,
join
,
lower
from
string
import
find
,
join
,
lower
...
@@ -126,27 +126,6 @@ class ObjectManager(
...
@@ -126,27 +126,6 @@ class ObjectManager(
return
filter
(
None
,
map
(
lambda
x
,
v
=
t
,
s
=
self
:
return
filter
(
None
,
map
(
lambda
x
,
v
=
t
,
s
=
self
:
(
x
[
'meta_type'
]
in
v
)
and
getattr
(
s
,
x
[
'id'
])
or
None
,
(
x
[
'meta_type'
]
in
v
)
and
getattr
(
s
,
x
[
'id'
])
or
None
,
self
.
_objects
))
self
.
_objects
))
r
=
[]
for
i
in
self
.
_objects
:
c
=
'Unknown class'
oid
=
'Unknown id'
id
=
i
[
'id'
]
try
:
o
=
getattr
(
self
,
id
)
oid
=
o
.
_p_oid
c
=
o
.
__class__
.
__name__
o
.
id
except
:
o
=
Broken
(
id
,
"<strong>Broken</strong>: %s: %s
\
n
class=%s, id=%s"
%
(
sys
.
exc_type
,
sys
.
exc_value
,
c
,
oid
))
r
.
append
(
o
)
return
r
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
,
t
=
None
):
...
@@ -363,7 +342,10 @@ class ObjectManager(
...
@@ -363,7 +342,10 @@ class ObjectManager(
except
:
pass
except
:
pass
self
.
_setProperty
(
id
,
value
,
type
)
self
.
_setProperty
(
id
,
value
,
type
)
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
return
self
.
manage_propertiesForm
(
self
,
REQUEST
)
return
MessageDialog
(
title
=
'Success!'
,
message
=
'Your changes have been saved'
,
action
=
'manage_propertiesForm'
)
def
manage_editProperties
(
self
,
REQUEST
):
def
manage_editProperties
(
self
,
REQUEST
):
"""Edit object properties"""
"""Edit object properties"""
...
@@ -371,25 +353,34 @@ class ObjectManager(
...
@@ -371,25 +353,34 @@ class ObjectManager(
n
=
p
[
'id'
]
n
=
p
[
'id'
]
try
:
setattr
(
self
,
n
,
REQUEST
[
n
])
try
:
setattr
(
self
,
n
,
REQUEST
[
n
])
except
:
setattr
(
self
,
n
,
''
)
except
:
setattr
(
self
,
n
,
''
)
return
self
.
manage_propertiesForm
(
self
,
REQUEST
)
return
MessageDialog
(
title
=
'Success!'
,
message
=
'Your changes have been saved'
,
action
=
'manage_propertiesForm'
)
def
manage_delProperties
(
self
,
ids
,
REQUEST
):
def
manage_delProperties
(
self
,
ids
,
REQUEST
=
None
):
"""Delete one or more properties"""
"""Delete one or more properties"""
try
:
p
=
self
.
_reserved_names
try
:
p
=
self
.
_reserved_names
except
:
p
=
()
except
:
p
=
()
if
ids
is
None
:
return
MessageDialog
(
title
=
'No property specified'
,
message
=
'No properties were specified!'
,
action
=
'./manage_propertiesForm'
,)
for
n
in
ids
:
for
n
in
ids
:
if
n
in
p
:
if
n
in
p
:
return
MessageDialog
(
return
MessageDialog
(
title
=
'Cannot delete %s'
%
n
,
title
=
'Cannot delete %s'
%
n
,
message
=
'The property <I>%s</I> cannot be deleted.'
%
n
,
message
=
'The property <I>%s</I> cannot be deleted.'
%
n
,
action
=
'manage_propertiesForm'
,
action
=
'manage_propertiesForm'
)
target
=
'manage_main'
)
try
:
self
.
_delProperty
(
n
)
try
:
self
.
_delProperty
(
n
)
except
:
raise
'BadRequest'
,
(
except
:
raise
'BadRequest'
,
(
'The property <I>%s</I> does not exist'
%
n
)
'The property <I>%s</I> does not exist'
%
n
)
if
REQUEST
is
not
None
:
return
MessageDialog
(
title
=
'Success!'
,
message
=
'Your changes have been saved'
,
action
=
'manage_propertiesForm'
)
return
self
.
manage_propertiesForm
(
self
,
REQUEST
)
def
_defaultInput
(
self
,
n
,
t
,
v
):
def
_defaultInput
(
self
,
n
,
t
,
v
):
return
'<INPUT NAME="%s:%s" SIZE="40" VALUE="%s"></TD>'
%
(
n
,
t
,
v
)
return
'<INPUT NAME="%s:%s" SIZE="40" VALUE="%s"></TD>'
%
(
n
,
t
,
v
)
...
@@ -475,19 +466,14 @@ class ObjectManager(
...
@@ -475,19 +466,14 @@ class ObjectManager(
except
:
return
0
except
:
return
0
return
1
return
1
class
Broken
:
icon
=
'p_/broken'
modified_in_session
=
0
def
__init__
(
self
,
id
,
title
):
self
.
id
=
id
self
.
title
=
title
##############################################################################
##############################################################################
#
#
# $Log: ObjectManager.py,v $
# $Log: ObjectManager.py,v $
# Revision 1.3
2 1998/01/22 00:15:01 jim
# Revision 1.3
3 1998/01/26 16:33:13 brian
# Added
machinery to handle broken objects
# Added
confirmation to property editing
#
#
# Revision 1.31 1998/01/08 17:40:42 jim
# Revision 1.31 1998/01/08 17:40:42 jim
# Modified __class_init__ to use default class init defined in Globals.
# Modified __class_init__ to use default class init defined in Globals.
...
...
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