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
04107363
Commit
04107363
authored
Apr 15, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up some webdav cruft.
parent
bb3ef58c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
169 deletions
+2
-169
lib/python/OFS/PropertySheets.py
lib/python/OFS/PropertySheets.py
+1
-106
lib/python/webdav/davcmds.py
lib/python/webdav/davcmds.py
+1
-63
No files found.
lib/python/OFS/PropertySheets.py
View file @
04107363
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Property sheets"""
__version__
=
'$Revision: 1.3
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
8
$'
[
11
:
-
2
]
import
time
,
string
,
App
.
Management
,
Globals
from
ZPublisher.Converters
import
type_converters
...
...
@@ -372,114 +372,9 @@ class PropertySheet(Persistent, Implicit):
return
def
odav__propstat
(
self
,
name
,
propstat
=
propstat
,
propdesc
=
propdesc
,
join
=
string
.
join
):
# DAV helper method - return a propstat element indicating
# property name and value for the requested property.
xml_id
=
self
.
xml_namespace
()
propdict
=
self
.
_propdict
()
if
not
propdict
.
has_key
(
name
):
prop
=
' <n:%s/>'
%
name
error
=
propdesc
%
(
'The property %s does not exist.'
%
name
)
return
propstat
%
(
xml_id
,
prop
,
'404 Not Found'
,
error
)
else
:
item
=
propdict
[
name
]
name
,
type
=
item
[
'id'
],
item
.
get
(
'type'
,
'string'
)
value
=
self
.
getProperty
(
name
)
if
type
==
'tokens'
:
value
=
join
(
value
,
' '
)
elif
type
==
'lines'
:
value
=
join
(
value
,
'
\
n
'
)
# allow for xml properties
attrs
=
item
.
get
(
'meta'
,
{}).
get
(
'__xml_attrs__'
,
None
)
if
attrs
is
not
None
:
attrs
=
map
(
lambda
n
:
' %s="%s"'
%
n
,
attrs
.
items
())
attrs
=
join
(
attrs
,
''
)
else
:
# quote non-xml items here?
attrs
=
''
prop
=
' <n:%s%s>%s</n:%s>'
%
(
name
,
attrs
,
value
,
name
)
return
propstat
%
(
xml_id
,
prop
,
'200 OK'
,
''
)
del
propstat
del
propdesc
def
olddav__propstat
(
self
,
allprop
,
names
,
join
=
string
.
join
):
# The dav__propstat method returns a chunk of xml containing
# one or more propstat elements indicating property names,
# values, errors and status codes. This is called by some
# of the WebDAV support machinery. If a property set does
# not support WebDAV, this method should return an empty
# string.
propstat
=
'<d:propstat xmlns:n="%s">
\
n
'
\
' <d:prop>
\
n
'
\
'%%s
\
n
'
\
' </d:prop>
\
n
'
\
' <d:status>HTTP/1.1 %%s</d:status>
\
n
%%s'
\
'</d:propstat>
\
n
'
%
self
.
xml_namespace
()
errormsg
=
' <d:responsedescription>
\
n
%s
\
n
'
\
' </d:responsedescription>
\
n
'
result
=
[]
if
not
allprop
and
not
names
:
# return property names only.
for
name
in
self
.
propertyIds
():
result
.
append
(
' <n:%s/>'
%
name
)
if
not
result
:
return
''
result
=
join
(
result
,
'
\
n
'
)
return
propstat
%
(
result
,
'200 OK'
,
''
)
elif
allprop
:
# return property names and values.
for
item
in
self
.
propertyMap
():
name
,
type
=
item
[
'id'
],
item
.
get
(
'type'
,
'string'
)
value
=
self
.
getProperty
(
name
)
if
type
==
'tokens'
:
value
=
join
(
value
,
' '
)
elif
type
==
'lines'
:
value
=
join
(
value
,
'
\
n
'
)
# allow for xml properties
meta
=
item
.
get
(
'meta'
,
{})
attrs
=
meta
.
get
(
'__xml_attrs__'
,
None
)
if
attrs
is
not
None
:
attrs
=
map
(
lambda
n
:
' %s="%s"'
%
n
,
attrs
.
items
())
attrs
=
join
(
attrs
,
''
)
else
:
attrs
=
''
prop
=
' <n:%s%s>%s</n:%s>'
%
(
name
,
attrs
,
value
,
name
)
result
.
append
(
prop
)
if
not
result
:
return
''
result
=
join
(
result
,
'
\
n
'
)
return
propstat
%
(
result
,
'200 OK'
,
''
)
else
:
# return names and values for named properties.
propdict
=
self
.
_propdict
()
xml_id
=
self
.
xml_namespace
()
for
name
,
ns
in
names
:
if
ns
==
xml_id
:
if
not
propdict
.
has_key
(
name
):
prop
=
' <n:%s/>'
%
name
emsg
=
errormsg
%
(
'The property %s does not exist.'
%
name
)
result
.
append
(
propstat
%
(
prop
,
'404 Not Found'
,
emsg
))
else
:
item
=
propdict
[
name
]
name
,
type
=
item
[
'id'
],
item
.
get
(
'type'
,
'string'
)
value
=
self
.
getProperty
(
name
)
if
type
==
'tokens'
:
value
=
join
(
value
,
' '
)
elif
type
==
'lines'
:
value
=
join
(
value
,
'
\
n
'
)
# allow for xml properties
meta
=
item
.
get
(
'meta'
,
{})
attrs
=
meta
.
get
(
'__xml_attrs__'
,
None
)
if
attrs
is
not
None
:
attrs
=
map
(
lambda
n
:
' %s="%s"'
%
n
,
attrs
.
items
())
attrs
=
join
(
attrs
,
''
)
else
:
attrs
=
''
prop
=
' <n:%s%s>%s</n:%s>'
%
(
name
,
attrs
,
value
,
name
)
result
.
append
(
propstat
%
(
prop
,
'200 OK'
,
''
))
if
not
result
:
return
''
return
join
(
result
,
''
)
# Web interface
...
...
lib/python/webdav/davcmds.py
View file @
04107363
...
...
@@ -85,7 +85,7 @@
"""WebDAV xml request objects."""
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
regex
from
common
import
absattr
,
aq_base
,
urlfix
,
urlbase
...
...
@@ -215,68 +215,6 @@ class PropFind:
return
result
.
getvalue
()
def
oapply
(
self
,
obj
,
url
=
None
,
depth
=
0
,
result
=
None
,
top
=
1
):
if
result
is
None
:
result
=
StringIO
()
depth
=
self
.
depth
url
=
urlfix
(
self
.
request
[
'URL'
],
'PROPFIND'
)
url
=
urlbase
(
url
)
result
.
write
(
'<?xml version="1.0" encoding="utf-8"?>
\
n
'
\
'<d:multistatus xmlns:d="DAV:">
\
n
'
)
iscol
=
hasattr
(
obj
,
'__dav_collection__'
)
if
iscol
and
url
[
-
1
]
!=
'/'
:
url
=
url
+
'/'
result
.
write
(
'<d:response>
\
n
<d:href>%s</d:href>
\
n
'
%
url
)
if
hasattr
(
obj
,
'__propsets__'
):
propsets
=
obj
.
propertysheets
.
values
()
obsheets
=
obj
.
propertysheets
else
:
davprops
=
DAVProps
(
obj
)
propsets
=
(
davprops
,)
obsheets
=
{
'DAV:'
:
davprops
}
if
self
.
allprop
:
stats
=
[]
for
ps
in
propsets
:
if
hasattr
(
aq_base
(
ps
),
'dav__allprop'
):
stats
.
append
(
ps
.
dav__allprop
())
stats
=
string
.
join
(
stats
,
''
)
or
'<d:status>200 OK</d:status>
\
n
'
result
.
write
(
stats
)
elif
self
.
propname
:
stats
=
[]
for
ps
in
propsets
:
if
hasattr
(
aq_base
(
ps
),
'dav__propnames'
):
stats
.
append
(
ps
.
dav__propnames
())
stats
=
string
.
join
(
stats
,
''
)
or
'<d:status>200 OK</d:status>
\
n
'
result
.
write
(
stats
)
elif
self
.
propnames
:
for
name
,
ns
in
self
.
propnames
:
ps
=
obsheets
.
get
(
ns
,
None
)
if
ps
is
not
None
and
hasattr
(
aq_base
(
ps
),
'dav__propstat'
):
stat
=
ps
.
dav__propstat
(
name
)
else
:
stat
=
'<d:propstat xmlns:n="%s">
\
n
'
\
' <d:prop>
\
n
'
\
' <n:%s/>
\
n
'
\
' </d:prop>
\
n
'
\
' <d:status>HTTP/1.1 404 Not Found</d:status>
\
n
'
\
' <d:responsedescription>
\
n
'
\
' The property %s does not exist.
\
n
'
\
' </d:responsedescription>
\
n
'
\
'</d:propstat>
\
n
'
%
(
ns
,
name
,
name
)
result
.
write
(
stat
)
else
:
raise
'Bad Request'
,
'Invalid request'
result
.
write
(
'</d:response>
\
n
'
)
if
depth
in
(
'1'
,
'infinity'
)
and
iscol
:
for
ob
in
obj
.
objectValues
():
dflag
=
hasattr
(
ob
,
'_p_changed'
)
and
(
ob
.
_p_changed
==
None
)
if
hasattr
(
ob
,
'__dav_resource__'
):
uri
=
os
.
path
.
join
(
url
,
absattr
(
ob
.
id
))
depth
=
depth
==
'infinity'
and
depth
or
0
self
.
apply
(
ob
,
uri
,
depth
,
result
,
top
=
0
)
if
dflag
:
ob
.
_p_deactivate
()
if
not
top
:
return
result
result
.
write
(
'</d:multistatus>'
)
return
result
.
getvalue
()
class
PropPatch
:
"""Model a PROPPATCH 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