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
4439ae48
Commit
4439ae48
authored
Mar 02, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed _ names for set, update, del methods.
parent
0b0ce8a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
lib/python/OFS/PropertySheets.py
lib/python/OFS/PropertySheets.py
+11
-10
No files found.
lib/python/OFS/PropertySheets.py
View file @
4439ae48
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Property sheets"""
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
import
time
,
string
,
App
.
Management
from
ZPublisher.Converters
import
type_converters
...
...
@@ -124,6 +124,7 @@ class View(App.Management.Tabs):
return
PropertySheet
.
inheritedAttribute
(
'tabs_path_info'
)(
self
,
script
,
path
)
class
PropertySheet
(
Persistent
,
Implicit
):
"""A PropertySheet is a container for a set of related properties and
metadata describing those properties. PropertySheets may or may not
...
...
@@ -169,7 +170,7 @@ class PropertySheet(Persistent, Implicit):
return
getattr
(
self
.
v_self
(),
id
)
return
default
def
setProperty
(
self
,
id
,
value
,
type
=
'string'
,
meta
=
None
):
def
_
setProperty
(
self
,
id
,
value
,
type
=
'string'
,
meta
=
None
):
# Set a new property with the given id, value and optional type.
# Note that different property sets may support different typing
# systems.
...
...
@@ -182,7 +183,7 @@ class PropertySheet(Persistent, Implicit):
self
.
_properties
=
self
.
_properties
+
(
prop
,)
setattr
(
self
,
id
,
value
)
def
updateProperty
(
self
,
id
,
value
):
def
_
updateProperty
(
self
,
id
,
value
):
# 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.
...
...
@@ -194,7 +195,7 @@ class PropertySheet(Persistent, Implicit):
value
=
type_converters
[
proptype
](
value
)
setattr
(
self
.
v_self
(),
id
,
value
)
def
delProperty
(
self
,
id
):
def
_
delProperty
(
self
,
id
):
# Delete the property with the given id. If a property with the
# given id does not exist, a ValueError is raised.
if
not
self
.
hasProperty
(
id
):
...
...
@@ -290,7 +291,7 @@ class PropertySheet(Persistent, Implicit):
the given id, type, and value."""
if
type_converters
.
has_key
(
type
):
value
=
type_converters
[
type
](
value
)
self
.
setProperty
(
id
,
value
,
type
)
self
.
_
setProperty
(
id
,
value
,
type
)
if
REQUEST
is
not
None
:
return
self
.
manage_propertiesForm
(
self
,
REQUEST
)
...
...
@@ -309,7 +310,7 @@ class PropertySheet(Persistent, Implicit):
if
self
.
hasProperty
(
name
):
if
not
'w'
in
propdict
[
name
].
get
(
'mode'
,
'wd'
):
raise
'BadRequest'
,
'%s cannot be changed.'
%
name
vself
.
updateProperty
(
name
,
value
)
vself
.
_
updateProperty
(
name
,
value
)
if
REQUEST
is
not
None
:
return
MessageDialog
(
title
=
'Success!'
,
...
...
@@ -337,7 +338,7 @@ class PropertySheet(Persistent, Implicit):
title
=
'Cannot delete %s'
%
id
,
message
=
'The property <em>%s</em> cannot be deleted.'
%
id
,
action
=
'manage_propertiesForm'
)
self
.
delProperty
(
id
)
self
.
_
delProperty
(
id
)
if
REQUEST
is
not
None
:
return
self
.
manage_propertiesForm
(
self
,
REQUEST
)
...
...
@@ -382,13 +383,13 @@ class DAVProperties(Virtual, PropertySheet):
return
default
return
getattr
(
self
,
method
)()
def
setProperty
(
self
,
id
,
value
,
type
=
'string'
,
meta
=
None
):
def
_
setProperty
(
self
,
id
,
value
,
type
=
'string'
,
meta
=
None
):
raise
ValueError
,
'Property cannot be set.'
def
updateProperty
(
self
,
id
,
value
):
def
_
updateProperty
(
self
,
id
,
value
):
raise
ValueError
,
'Property cannot be set.'
def
delProperty
(
self
,
id
):
def
_
delProperty
(
self
,
id
):
raise
ValueError
,
'Property cannot be deleted.'
def
propertyMap
(
self
):
...
...
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