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
94603fc9
Commit
94603fc9
authored
Sep 29, 2003
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Collector #1058: Several fixes for PropertySheets when used
outside ZClasses
parent
31af7fe6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
15 deletions
+58
-15
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/OFS/PropertySheets.py
lib/python/OFS/PropertySheets.py
+34
-5
lib/python/OFS/dtml/properties.dtml
lib/python/OFS/dtml/properties.dtml
+2
-0
lib/python/OFS/dtml/propertysheets.dtml
lib/python/OFS/dtml/propertysheets.dtml
+19
-10
No files found.
doc/CHANGES.txt
View file @
94603fc9
...
...
@@ -8,6 +8,9 @@ Zope Changes
Bugs fixed
- Collector #1058: Several fixes for PropertySheets when used
outside ZClasses
- Collector #1053: parseIndexRequest turned empty sequence of search
terms into unrestricted search.
...
...
lib/python/OFS/PropertySheets.py
View file @
94603fc9
...
...
@@ -13,7 +13,7 @@
"""Property sheets"""
__version__
=
'$Revision: 1.
89
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
90
$'
[
11
:
-
2
]
import
time
,
App
.
Management
,
Globals
from
webdav.WriteLockInterface
import
WriteLockInterface
...
...
@@ -30,6 +30,11 @@ from AccessControl import getSecurityManager
from
webdav.common
import
isDavCollection
from
cgi
import
escape
# DM: we would like to import this from somewhere
BadRequestException
=
'Bad Request'
class
View
(
App
.
Management
.
Tabs
,
Base
):
"""A view of an object, typically used for management purposes
...
...
@@ -600,6 +605,9 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
)
# optionally to be overridden by derived classes
PropertySheetClass
=
PropertySheet
webdav
=
DAVProperties
()
def
_get_defaults
(
self
):
return
(
self
.
webdav
,)
...
...
@@ -639,12 +647,14 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
return
propset
.
__of__
(
self
)
return
default
def
manage_addPropertySheet
(
self
,
id
,
ns
):
def
manage_addPropertySheet
(
self
,
id
,
ns
,
REQUEST
=
None
):
""" """
md
=
{
'xmlns'
:
ns
}
ps
=
PropertySheet
(
id
,
md
)
ps
=
self
.
PropertySheetClass
(
id
,
md
)
self
.
addPropertySheet
(
ps
)
return
'OK'
if
REQUEST
is
None
:
return
ps
ps
=
self
.
get
(
id
)
REQUEST
.
RESPONSE
.
redirect
(
'%s/manage'
%
ps
.
absolute_url
())
def
addPropertySheet
(
self
,
propset
):
propsets
=
self
.
aq_parent
.
__propsets__
...
...
@@ -658,6 +668,25 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
result
.
append
(
propset
)
self
.
aq_parent
.
__propsets__
=
tuple
(
result
)
## DM: deletion support
def
isDeletable
(
self
,
name
):
'''currently, we say that *name* is deletable when it is not a
default sheet. Later, we may further restrict deletability
based on an instance attribute.'''
ps
=
self
.
get
(
name
)
if
ps
is
None
:
return
0
if
ps
in
self
.
_get_defaults
():
return
0
return
1
def
manage_delPropertySheets
(
self
,
ids
=
(),
REQUEST
=
None
):
'''delete all sheets identified by *ids*.'''
for
id
in
ids
:
if
not
self
.
isDeletable
(
id
):
raise
BadRequestException
,
'attempt to delete undeletable property sheet: '
+
id
self
.
delPropertySheet
(
id
)
if
REQUEST
is
not
None
:
REQUEST
.
RESPONSE
.
redirect
(
'%s/manage'
%
self
.
absolute_url
())
def
__len__
(
self
):
return
len
(
self
.
__propsets__
())
...
...
@@ -677,7 +706,7 @@ class PropertySheets(Traversable, Implicit, App.Management.Tabs):
if
r
is
None
:
pre
=
'../'
else
:
pre
=
r
[
'URL'
]
pre
=
r
[
'URL
PATH0
'
]
for
i
in
(
1
,
2
):
l
=
pre
.
rfind
(
'/'
)
if
l
>=
0
:
...
...
lib/python/OFS/dtml/properties.dtml
View file @
94603fc9
...
...
@@ -41,6 +41,7 @@ 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>
<td align="left" valign="top" width="16">
<dtml-if "'d' in _['sequence-item'].get('mode', 'awd')">
...
...
@@ -156,6 +157,7 @@ property values, edit the values and click "Save Changes".
</div>
</td>
</tr>
</dtml-let>
</dtml-in>
<tr>
<td colspan="2"> </td>
...
...
lib/python/OFS/dtml/propertysheets.dtml
View file @
94603fc9
...
...
@@ -4,12 +4,15 @@
<form action="&dtml-URL1;" method="post">
<table cellspacing="0" cellpadding="2" border="0">
<dtml-in items sort>
<dtml-with "_(REQUEST=REQUEST, item=_['sequence-item'].aq_base)" only>
<dtml-with "_(REQUEST=REQUEST, item=_['sequence-item'].aq_base
, isDeletable=isDeletable
)" only>
<dtml-with item>
<dtml-if id>
<tr>
<td align="left" valign="top">
<a href="&dtml-id;">&dtml-id; (&dtml-xml_namespace;)</a>
<dtml-if expr="isDeletable(id)"><input type=checkbox name="ids:list" value="&dtml-id;"></dtml-if>
</td>
<td align="left" valign="top">
<a href="&dtml-id;/manage">&dtml-id; <dtml-if xml_namespace>(<dtml-var xml_namespace>)</dtml-if></a>
<dtml-if locked_in_session>
<dtml-if modified_in_session>
<img src="&dtml-BASEPATH1;/p_/locked"
...
...
@@ -25,18 +28,24 @@
</dtml-with>
</dtml-with>
</dtml-in>
</table>
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
<input type="submit" name="manage_addPropertySheetForm:method"
class="form-element" value="Add">
<td colspan=2>
<input type="submit" name="manage_delPropertySheets:method"
class="form-element" value="Delete">
</td>
</tr>
</table>
<table cellpadding=5>
<tr>
<td><span class="form-label">Name:</span> <input name="id"></td>
<td><span class="form-label">Namespace:</span> <input name="ns"></td>
<td>
<input type="submit" name="manage_addPropertySheet:method"
class="form-element" value="Add">
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
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