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
575dfc86
Commit
575dfc86
authored
Nov 05, 1999
by
Amos Latteier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documented and fixed the creation of selection and multiple selection properties.
parent
a7ce107d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
7 deletions
+28
-7
lib/python/OFS/PropertyManager.py
lib/python/OFS/PropertyManager.py
+20
-4
lib/python/OFS/properties.dtml
lib/python/OFS/properties.dtml
+8
-3
No files found.
lib/python/OFS/PropertyManager.py
View file @
575dfc86
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Property management"""
__version__
=
'$Revision: 1.1
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
8
$'
[
11
:
-
2
]
import
ExtensionClass
,
Globals
import
ZDOM
...
...
@@ -123,7 +123,13 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
and a 'type' key. The 'id' key contains the name of the property,
and the 'type' key contains a string representing the object's type.
The 'type' string must be one of the values: 'float', 'int', 'long',
'string', 'lines', 'text', 'date' or 'tokens'.
'string', 'lines', 'text', 'date', 'tokens', 'selection', or
'multiple section'.
For 'selection' and 'multiple selection' properties, there is an
addition item in the property dictionay, 'select_variable' which
provides the name of a property or method which returns a list of
strings from which the selection(s) can be chosen.
Each entry in the _properties structure may *optionally* provide a
'mode' key, which specifies the mutability of the property. The 'mode'
...
...
@@ -203,10 +209,20 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
def
_delPropValue
(
self
,
id
):
delattr
(
self
,
id
)
def
_setProperty
(
self
,
id
,
value
,
type
=
'string'
):
# for selection and multiple selection properties
# the value argument indicates the select variable
# of the property
if
not
self
.
valid_property_id
(
id
):
raise
'Bad Request'
,
'Invalid or duplicate property id'
self
.
_properties
=
self
.
_properties
+
({
'id'
:
id
,
'type'
:
type
},)
self
.
_setPropValue
(
id
,
value
)
if
type
in
(
'selection'
,
'multiple selection'
):
if
not
hasattr
(
self
,
value
):
raise
'Bad Request'
,
'No select variable %s'
%
value
self
.
_properties
=
self
.
_properties
+
(
{
'id'
:
id
,
'type'
:
type
,
'select_variable'
:
value
},)
self
.
_setPropValue
(
id
,
''
)
else
:
self
.
_properties
=
self
.
_properties
+
({
'id'
:
id
,
'type'
:
type
},)
self
.
_setPropValue
(
id
,
value
)
def
_updateProperty
(
self
,
id
,
value
):
# Update the value of an existing property. If value
...
...
lib/python/OFS/properties.dtml
View file @
575dfc86
...
...
@@ -79,10 +79,10 @@ values and click "Save Changes".
</dtml-in>
</select>
<dtml-else>
No value for
<dtml-var
select_variable
>
No value for
<dtml-var
select_variable
>
.
</dtml-if>
<dtml-elif
"
type=
='multiple
selection
'"
>
<dtml-if
select_variable
>
<dtml-if
"
_
.
has_key
(
select_variable
)"
>
<select
name=
"<dtml-var id>:list"
multiple
size=
"<dtml-var "
_
.
min
(
7
,
_
.
len
(
_
[
select_variable
]))"
>
">
<dtml-in
"
_
[
select_variable
]"
>
...
...
@@ -91,6 +91,8 @@ values and click "Save Changes".
>
>
<dtml-var
sequence-item
html_quote
></option>
</dtml-in>
</select>
<dtml-else>
No value for
<dtml-var
select_variable
>
.
</dtml-if>
<dtml-else>
<em>
Unknown property type
</em>
...
...
@@ -133,7 +135,10 @@ To add a property, click the "Add..." button.
<p>
To add a new property, enter a name, type and value for the new
property and click the
"
Add
"
button.
button. For
"
selection
"
and
"
multiple selection
"
properties enter the name of a selection variable in the
"
Value
"
field. The selection variable is a property or method that returns a list
of strings from which the selection(s) can be chosen.
</p>
<table>
<tr>
...
...
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