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
1a09f559
Commit
1a09f559
authored
Mar 04, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
d4169cad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
24 deletions
+16
-24
lib/python/OFS/PropertySheets.py
lib/python/OFS/PropertySheets.py
+16
-24
No files found.
lib/python/OFS/PropertySheets.py
View file @
1a09f559
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Property sheets"""
__version__
=
'$Revision: 1.1
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
3
$'
[
11
:
-
2
]
import
time
,
string
,
App
.
Management
from
ZPublisher.Converters
import
type_converters
...
...
@@ -185,7 +185,6 @@ class PropertySheet(Persistent, Implicit):
if
hasattr
(
aq_base
(
self
),
id
):
raise
'Bad Request'
,
(
'Invalid property id, %s. It is in use.'
%
id
)
if
meta
is
None
:
meta
=
{}
prop
=
{
'id'
:
id
,
'type'
:
type
,
'meta'
:
meta
}
self
.
_properties
=
self
.
_properties
+
(
prop
,)
...
...
@@ -198,8 +197,11 @@ class PropertySheet(Persistent, Implicit):
# it will used to _replace_ the properties meta data.
if
not
self
.
hasProperty
(
id
):
raise
'Bad Request'
,
'The property %s does not exist.'
%
id
propinfo
=
self
.
propertyInfo
(
id
)
if
not
'w'
in
propinfo
.
get
(
'mode'
,
'wd'
):
raise
'Bad Request'
,
'%s cannot be changed.'
%
id
if
type
(
value
)
==
type
(
''
):
proptype
=
self
.
prop
ertyInfo
(
id
)
.
get
(
'type'
,
'string'
)
proptype
=
self
.
prop
info
.
get
(
'type'
,
'string'
)
if
type_converters
.
has_key
(
proptype
):
value
=
type_converters
[
proptype
](
value
)
if
meta
is
not
None
:
...
...
@@ -214,11 +216,16 @@ class PropertySheet(Persistent, Implicit):
# 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
):
raise
ValueError
,
'The property %s does not exist.'
%
id
self
=
self
.
v_self
()
delattr
(
self
,
id
)
self
.
_properties
=
tuple
(
filter
(
lambda
i
,
n
=
id
:
i
[
'id'
]
!=
n
,
self
.
_properties
))
raise
'Bad Request'
,
'The property %s does not exist.'
%
id
vself
=
self
.
v_self
()
if
hasattr
(
vself
,
'_reserved_names'
):
nd
=
vself
.
_reserved_names
else
:
nd
=
()
if
(
not
'd'
in
self
.
propertyInfo
(
id
).
get
(
'mode'
,
'wd'
))
or
(
id
in
nd
):
raise
'Bad Request'
,
'%s cannot be deleted.'
%
id
delattr
(
vself
,
id
)
vself
.
_properties
=
tuple
(
filter
(
lambda
i
,
n
=
id
:
i
[
'id'
]
!=
n
,
vself
.
_properties
))
def
propertyIds
(
self
):
# Return a list of property ids.
...
...
@@ -238,7 +245,7 @@ class PropertySheet(Persistent, Implicit):
# Return a mapping containing property meta-data
for
p
in
self
.
propertyMap
():
if
p
[
'id'
]
==
id
:
return
p
raise
ValueError
,
'
Property %s not found
.'
%
id
raise
ValueError
,
'
The property %s does not exist
.'
%
id
def
propertyMap
(
self
):
# Return a tuple of mappings, giving meta-data for properties.
...
...
@@ -343,8 +350,6 @@ class PropertySheet(Persistent, Implicit):
vself
=
self
.
v_self
()
for
name
,
value
in
props
.
items
():
if
self
.
hasProperty
(
name
):
if
not
'w'
in
propdict
[
name
].
get
(
'mode'
,
'wd'
):
raise
'BadRequest'
,
'%s cannot be changed.'
%
name
vself
.
_updateProperty
(
name
,
value
)
if
REQUEST
is
not
None
:
return
MessageDialog
(
...
...
@@ -359,20 +364,7 @@ class PropertySheet(Persistent, Implicit):
title
=
'No property specified'
,
message
=
'No properties were specified!'
,
action
=
'./manage_propertiesForm'
,)
propdict
=
self
.
_propdict
()
vself
=
self
.
v_self
()
if
hasattr
(
vself
,
'_reserved_names'
):
nd
=
vself
.
_reserved_names
else
:
nd
=
()
for
id
in
ids
:
if
not
propdict
.
has_key
(
id
):
raise
'BadRequest'
,
(
'The property <em>%s</em> does not exist.'
%
id
)
if
(
not
'd'
in
propdict
[
id
].
get
(
'mode'
,
'wd'
))
or
(
id
in
nd
):
return
MessageDialog
(
title
=
'Cannot delete %s'
%
id
,
message
=
'The property <em>%s</em> cannot be deleted.'
%
id
,
action
=
'manage_propertiesForm'
)
self
.
_delProperty
(
id
)
if
REQUEST
is
not
None
:
return
self
.
manage_propertiesForm
(
self
,
REQUEST
)
...
...
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