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
f34bb029
Commit
f34bb029
authored
Mar 03, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed _updateProperty to allow update of metadata.
parent
62ae26da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
lib/python/OFS/PropertySheets.py
lib/python/OFS/PropertySheets.py
+10
-3
No files found.
lib/python/OFS/PropertySheets.py
View file @
f34bb029
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Property sheets"""
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
import
time
,
string
,
App
.
Management
from
ZPublisher.Converters
import
type_converters
...
...
@@ -182,16 +182,23 @@ class PropertySheet(Persistent, Implicit):
self
.
_properties
=
self
.
_properties
+
(
prop
,)
setattr
(
self
,
id
,
value
)
def
_updateProperty
(
self
,
id
,
value
):
def
_updateProperty
(
self
,
id
,
value
,
meta
=
None
):
# Update the value of an existing property. If value is a string,
# an attempt will be made to convert the value to the type of the
# existing property.
# existing property. If a mapping containing meta-data is passed,
# it will used to _replace_ the properties meta data.
if
not
self
.
hasProperty
(
id
):
raise
'Bad Request'
,
'The property %s does not exist.'
%
id
if
type
(
value
)
==
type
(
''
):
proptype
=
self
.
propertyInfo
(
id
).
get
(
'type'
,
'string'
)
if
type_converters
.
has_key
(
proptype
):
value
=
type_converters
[
proptype
](
value
)
if
meta
is
not
None
:
props
=
[]
for
prop
in
self
.
v_self
().
_properties
:
if
prop
[
'id'
]
==
id
:
prop
[
'meta'
]
=
meta
props
.
append
(
prop
)
self
.
v_self
().
_properties
=
props
setattr
(
self
.
v_self
(),
id
,
value
)
def
_delProperty
(
self
,
id
):
...
...
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