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
0a4c596d
Commit
0a4c596d
authored
Feb 22, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added methods to provide indirection from del/setattr.
parent
5ee567c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+7
-4
lib/python/OFS/PropertyManager.py
lib/python/OFS/PropertyManager.py
+8
-5
No files found.
lib/python/OFS/ObjectManager.py
View file @
0a4c596d
...
...
@@ -84,9 +84,9 @@
##############################################################################
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.5
0 1999/01/29 15:41:39 brian
Exp $"""
$Id: ObjectManager.py,v 1.5
1 1999/02/22 20:41:40 jim
Exp $"""
__version__
=
'$Revision: 1.5
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.5
1
$'
[
11
:
-
2
]
import
App.Management
,
Acquisition
,
App
.
Undo
,
Globals
import
App.FactoryDispatcher
...
...
@@ -182,9 +182,12 @@ class ObjectManager(
except
:
pass
return
()
def
_setOb
(
self
,
id
,
object
):
setattr
(
self
,
id
,
object
)
def
_delOb
(
self
,
id
):
delattr
(
self
,
id
)
def
_setObject
(
self
,
id
,
object
,
roles
=
None
,
user
=
None
):
self
.
_checkId
(
id
)
se
tattr
(
self
,
id
,
object
)
se
lf
.
_setOb
(
id
,
object
)
try
:
t
=
object
.
meta_type
except
:
t
=
None
self
.
_objects
=
self
.
_objects
+
({
'id'
:
id
,
'meta_type'
:
t
},)
...
...
@@ -200,7 +203,7 @@ class ObjectManager(
def
_delObject
(
self
,
id
):
delattr
(
self
,
id
)
self
.
_delOb
(
id
)
if
id
==
'acl_users'
:
# Yikes - acl_users is referred to by two names and
# must be treated as a special case!
...
...
lib/python/OFS/PropertyManager.py
View file @
0a4c596d
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Property management"""
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
from
ZPublisher.Converters
import
type_converters
...
...
@@ -180,11 +180,14 @@ class PropertyManager:
return
md
.
get
(
'type'
,
'string'
)
return
None
def
_setPropValue
(
self
,
id
,
value
):
setattr
(
self
,
id
,
value
)
def
_delPropValue
(
self
,
id
):
delattr
(
self
,
id
)
def
_setProperty
(
self
,
id
,
value
,
type
=
'string'
):
if
not
self
.
valid_property_id
(
id
):
raise
'Bad Request'
,
'Invalid or duplicate property id'
self
.
_properties
=
self
.
_properties
+
({
'id'
:
id
,
'type'
:
type
},)
se
tattr
(
self
,
id
,
value
)
se
lf
.
_setPropValue
(
id
,
value
)
def
_updateProperty
(
self
,
id
,
value
):
# Update the value of an existing property. If value
...
...
@@ -196,7 +199,7 @@ class PropertyManager:
proptype
=
self
.
getPropertyType
(
id
)
or
'string'
if
type_converters
.
has_key
(
proptype
):
value
=
type_converters
[
proptype
](
value
)
se
tattr
(
self
,
id
,
value
)
se
lf
.
_setPropValue
(
id
,
value
)
def
hasProperty
(
self
,
id
):
"""Return true if object has a property 'id'"""
...
...
@@ -255,7 +258,7 @@ class PropertyManager:
"""Edit object properties via the web."""
for
p
in
self
.
_properties
:
n
=
p
[
'id'
]
se
tattr
(
self
,
n
,
REQUEST
.
get
(
n
,
''
))
se
lf
.
_setPropValue
(
n
,
REQUEST
.
get
(
n
,
''
))
return
MessageDialog
(
title
=
'Success!'
,
message
=
'Your changes have been saved'
,
...
...
@@ -281,7 +284,7 @@ class PropertyManager:
if
self
.
hasProperty
(
name
):
if
not
'w'
in
propdict
[
name
].
get
(
'mode'
,
'wd'
):
raise
'BadRequest'
,
'%s cannot be changed'
%
name
se
tattr
(
self
,
name
,
value
)
se
lf
.
_setPropValue
(
name
,
value
)
if
REQUEST
is
not
None
:
return
MessageDialog
(
...
...
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