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
4f5b11dc
Commit
4f5b11dc
authored
Mar 04, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed xml attr handling for dead properties
parent
1a09f559
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
14 deletions
+34
-14
lib/python/webdav/xmlcmds.py
lib/python/webdav/xmlcmds.py
+26
-13
lib/python/webdav/xmltools.py
lib/python/webdav/xmltools.py
+8
-1
No files found.
lib/python/webdav/xmlcmds.py
View file @
4f5b11dc
...
...
@@ -85,7 +85,7 @@
"""WebDAV xml request objects."""
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
import
sys
,
os
,
string
from
common
import
absattr
,
aq_base
,
urlfix
...
...
@@ -164,22 +164,32 @@ class PropPatch:
e
=
root
.
elements
(
'propertyupdate'
,
ns
=
dav
)[
0
]
for
ob
in
e
.
elements
():
if
ob
.
name
()
==
'set'
and
ob
.
namespace
()
==
dav
:
prop
=
ob
.
elements
(
'prop'
,
ns
=
dav
)[
0
]
for
val
in
prop
.
elements
():
prop
tag
=
ob
.
elements
(
'prop'
,
ns
=
dav
)[
0
]
for
prop
in
proptag
.
elements
():
# We have to ensure that all tag attrs (including
# an xmlns attr for all xml namespaces used by the
# element and its children) are saved, per rfc2518.
attrs
=
{}
val
.
remap
({})
for
attr
in
val
.
attrs
():
attrs
[
attr
.
name
()]
=
attr
.
value
()
md
=
{
'attrs'
:
attrs
,
'nsid'
:
val
.
__nskey__
}
item
=
(
val
.
name
(),
val
.
namespace
(),
val
.
strval
(),
md
)
vals
.
append
(
item
)
name
,
ns
=
prop
.
name
(),
prop
.
namespace
()
e
,
attrs
=
prop
.
elements
(),
prop
.
attrs
()
if
(
not
e
)
and
(
not
attrs
):
# simple property
item
=
(
name
,
ns
,
prop
.
strval
(),
{})
vals
.
append
(
item
)
else
:
# xml property
attrs
=
{}
prop
.
remap
({
ns
:
'n'
})
prop
.
del_attr
(
'xmlns:n'
)
for
attr
in
prop
.
attrs
():
attrs
[
attr
.
qname
()]
=
attr
.
value
()
md
=
{
'__xml_attrs__'
:
attrs
}
item
=
(
name
,
ns
,
prop
.
strval
(),
md
)
vals
.
append
(
item
)
if
ob
.
name
()
==
'remove'
and
ob
.
namespace
()
==
dav
:
prop
=
ob
.
elements
(
'prop'
,
ns
=
dav
)[
0
]
for
val
in
prop
.
elements
():
item
=
(
val
.
name
(),
val
.
namespace
())
prop
tag
=
ob
.
elements
(
'prop'
,
ns
=
dav
)[
0
]
for
prop
in
proptag
.
elements
():
item
=
(
prop
.
name
(),
prop
.
namespace
())
vals
.
append
(
item
)
def
apply
(
self
,
obj
):
...
...
@@ -202,6 +212,7 @@ class PropPatch:
obj
.
propertysheets
.
manage_addPropertySheet
(
''
,
ns
)
propsets
=
obj
.
propertysheets
.
values
()
propset
=
propsets
.
get
(
ns
)
propdict
=
propset
.
_propdict
()
if
propset
.
hasProperty
(
name
):
try
:
propset
.
_updateProperty
(
name
,
val
,
meta
=
md
)
except
:
...
...
@@ -238,6 +249,8 @@ class PropPatch:
'</d:multistatus>'
%
errmsg
)
result
=
result
.
getvalue
()
if
not
errors
:
return
result
# This is lame, but I cant find a way to keep ZPublisher
# from sticking a traceback into my xml response :(
get_transaction
().
abort
()
result
=
string
.
replace
(
result
,
'200 OK'
,
'424 Failed Dependency'
)
return
result
...
...
lib/python/webdav/xmltools.py
View file @
4f5b11dc
...
...
@@ -85,7 +85,7 @@
"""WebDAV XML parsing tools."""
__version__
=
'$Revision: 1.
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
3
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
xmllib
from
Acquisition
import
Implicit
...
...
@@ -211,6 +211,13 @@ class Element(Node):
return
attr
return
default
def
del_attr
(
self
,
name
):
attrs
=
[]
for
attr
in
self
.
__attrs__
:
if
attr
.
name
()
!=
name
:
attrs
.
append
(
attr
)
self
.
__attrs__
=
attrs
def
remap
(
self
,
dict
,
n
=
0
,
top
=
1
):
# The remap method effectively rewrites an element and all of its
# children, consolidating namespace declarations into the element
...
...
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