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
590060ec
Commit
590060ec
authored
May 05, 2008
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Launchpad #142350: Display description for properties as row title, if present.
parent
e57c2618
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
4 deletions
+54
-4
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/OFS/PropertyManager.py
lib/python/OFS/PropertyManager.py
+10
-0
lib/python/OFS/dtml/properties.dtml
lib/python/OFS/dtml/properties.dtml
+3
-2
lib/python/OFS/tests/testProperties.py
lib/python/OFS/tests/testProperties.py
+38
-2
No files found.
doc/CHANGES.txt
View file @
590060ec
...
...
@@ -8,6 +8,9 @@ Zope Changes
Bugs Fixed
- Launchpad #142350: Display description for properties as row title,
if present.
- Launchpad #200007: DateTime(anotherDateTime) now preserves the
timezone.
...
...
lib/python/OFS/PropertyManager.py
View file @
590060ec
...
...
@@ -258,6 +258,16 @@ class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
return
p
.
get
(
'label'
,
id
)
return
id
security
.
declareProtected
(
access_contents_information
,
'propertyDescription'
)
def
propertyDescription
(
self
,
id
):
"""Return a description for the given property id
"""
for
p
in
self
.
_properties
:
if
p
[
'id'
]
==
id
:
return
p
.
get
(
'description'
,
''
)
return
id
security
.
declareProtected
(
access_contents_information
,
'propdict'
)
def
propdict
(
self
):
dict
=
{}
...
...
lib/python/OFS/dtml/properties.dtml
View file @
590060ec
...
...
@@ -61,8 +61,9 @@ property values, edit the values and click "Save Changes".
</tr>
<dtml-in propertyMap mapping>
<dtml-let type="not _.has_key('type') and 'string' or type">
<tr>
<dtml-let type="not _.has_key('type') and 'string' or type"
pdesc="propertyDescription(id)">
<tr title="&dtml-pdesc;">
<td align="left" valign="top" width="16">
<dtml-if "'d' in _['sequence-item'].get('mode', 'awd')">
<input type="checkbox" name="_ids:<dtml-var "REQUEST['management_page_charset_tag']">string:list" value="&dtml-id;"
...
...
lib/python/OFS/tests/testProperties.py
View file @
590060ec
...
...
@@ -21,10 +21,12 @@ import unittest
class
TestPropertyManager
(
unittest
.
TestCase
):
"""Property management tests."""
def
_
makeOne
(
self
,
*
args
,
**
kw
):
def
_
getTargetClass
(
self
):
from
OFS.PropertyManager
import
PropertyManager
return
PropertyManager
return
PropertyManager
(
*
args
,
**
kw
)
def
_makeOne
(
self
,
*
args
,
**
kw
):
return
self
.
_getTargetClass
()(
*
args
,
**
kw
)
def
test_z3interfaces
(
self
):
from
OFS.interfaces
import
IPropertyManager
...
...
@@ -52,6 +54,40 @@ class TestPropertyManager(unittest.TestCase):
self
.
failUnless
(
type
(
inst
.
getProperty
(
'prop2'
))
==
type
(()))
self
.
failUnless
(
type
(
inst
.
prop2
)
==
type
(()))
def
test_propertyLabel_no_label_falls_back_to_id
(
self
):
class
NoLabel
(
self
.
_getTargetClass
()):
_properties
=
(
{
'id'
:
'no_label'
,
'type'
:
'string'
},
)
inst
=
NoLabel
()
self
.
assertEqual
(
inst
.
propertyLabel
(
'no_label'
),
'no_label'
)
def
test_propertyLabel_with_label
(
self
):
class
WithLabel
(
self
.
_getTargetClass
()):
_properties
=
(
{
'id'
:
'with_label'
,
'type'
:
'string'
,
'label'
:
'With Label'
},
)
inst
=
WithLabel
()
self
.
assertEqual
(
inst
.
propertyLabel
(
'with_label'
),
'With Label'
)
def
test_propertyDescription_no_description_falls_back_to_id
(
self
):
class
NoDescription
(
self
.
_getTargetClass
()):
_properties
=
(
{
'id'
:
'no_description'
,
'type'
:
'string'
},
)
inst
=
NoDescription
()
self
.
assertEqual
(
inst
.
propertyDescription
(
'no_description'
),
''
)
def
test_propertyDescription_with_description
(
self
):
class
WithDescription
(
self
.
_getTargetClass
()):
_properties
=
(
{
'id'
:
'with_description'
,
'type'
:
'string'
,
'description'
:
'With Description'
},
)
inst
=
WithDescription
()
self
.
assertEqual
(
inst
.
propertyDescription
(
'with_description'
),
'With Description'
)
class
TestPropertySheet
(
unittest
.
TestCase
):
"""Property management tests."""
...
...
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