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
d7005989
Commit
d7005989
authored
Mar 10, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
b6ab6127
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
91 deletions
+42
-91
lib/python/OFS/PropertySheets.py
lib/python/OFS/PropertySheets.py
+40
-72
lib/python/webdav/xmlcmds.py
lib/python/webdav/xmlcmds.py
+2
-19
No files found.
lib/python/OFS/PropertySheets.py
View file @
d7005989
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Property sheets"""
__version__
=
'$Revision: 1.2
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
4
$'
[
11
:
-
2
]
import
time
,
string
,
App
.
Management
from
ZPublisher.Converters
import
type_converters
...
...
@@ -127,26 +127,6 @@ class View(App.Management.Tabs):
psxml
=
'<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
'
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
'
,
propdesc
=
' <d:responsedescription>
\
n
'
\
' %s
\
n
'
\
' </d:responsedescription>
\
n
'
class
PropertySheet
(
Persistent
,
Implicit
):
"""A PropertySheet is a container for a set of related properties and
metadata describing those properties. PropertySheets may or may not
...
...
@@ -279,22 +259,16 @@ class PropertySheet(Persistent, Implicit):
dict
[
p
[
'id'
]]
=
p
return
dict
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
'
## 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',
## propdesc=' <d:responsedescription>\n' \
## ' %s\n' \
## ' </d:responsedescription>\n'
propdesc
=
' <d:responsedescription>
\
n
'
\
' %s
\
n
'
\
' </d:responsedescription>
\
n
'
def
dav__allprop
(
self
,
propstat
=
propstat
,
join
=
string
.
join
):
# DAV helper method - return one or more propstat elements
...
...
@@ -331,7 +305,6 @@ class PropertySheet(Persistent, Implicit):
result
=
join
(
result
,
'
\
n
'
)
return
propstat
%
(
self
.
xml_namespace
(),
result
,
'200 OK'
,
''
)
def
dav__propstat
(
self
,
name
,
propstat
=
propstat
,
propdesc
=
propdesc
,
join
=
string
.
join
):
# DAV helper method - return a propstat element indicating
...
...
@@ -361,8 +334,8 @@ class PropertySheet(Persistent, Implicit):
prop
=
' <n:%s%s>%s</n:%s>'
%
(
name
,
attrs
,
value
,
name
)
return
propstat
%
(
xml_id
,
prop
,
'200 OK'
,
''
)
#
del propstat
#
del propdesc
del
propstat
del
propdesc
def
olddav__propstat
(
self
,
allprop
,
names
,
join
=
string
.
join
):
# The dav__propstat method returns a chunk of xml containing
...
...
@@ -516,7 +489,6 @@ class DAVProperties(Virtual, PropertySheet):
{
'id'
:
'getcontenttype'
,
'mode'
:
'r'
},
{
'id'
:
'getcontentlength'
,
'mode'
:
'r'
},
{
'id'
:
'source'
,
'mode'
:
'r'
},
{
'id'
:
'supportedlock'
,
'mode'
:
'r'
},
)
def
getProperty
(
self
,
id
,
default
=
None
):
...
...
@@ -544,46 +516,44 @@ class DAVProperties(Virtual, PropertySheet):
return
absattr
(
self
.
v_self
().
id
)
def
dav__resourcetype
(
self
):
self
=
self
.
v_self
()
if
hasattr
(
aq_base
(
self
),
'isAnObjectManager'
)
and
\
self
.
isAnObjectManager
:
return
'<
d
:collection/>'
v
self
=
self
.
v_self
()
if
hasattr
(
aq_base
(
v
self
),
'isAnObjectManager'
)
and
\
v
self
.
isAnObjectManager
:
return
'<
n
:collection/>'
return
''
def
dav__getlastmodified
(
self
):
self
=
self
.
v_self
()
if
hasattr
(
self
,
'_p_mtime'
):
return
rfc1123_date
(
self
.
_p_mtime
)
v
self
=
self
.
v_self
()
if
hasattr
(
v
self
,
'_p_mtime'
):
return
rfc1123_date
(
v
self
.
_p_mtime
)
return
''
def
dav__getcontenttype
(
self
):
self
=
self
.
v_self
()
if
hasattr
(
self
,
'content_type'
):
return
self
.
content_type
v
self
=
self
.
v_self
()
if
hasattr
(
v
self
,
'content_type'
):
return
v
self
.
content_type
return
''
def
dav__getcontentlength
(
self
):
self
=
self
.
v_self
()
if
hasattr
(
self
,
'get_size'
):
return
self
.
get_size
()
v
self
=
self
.
v_self
()
if
hasattr
(
v
self
,
'get_size'
):
return
v
self
.
get_size
()
return
''
def
dav__source
(
self
):
self
=
self
.
v_self
()
if
hasattr
(
self
,
'meta_type'
)
and
self
.
meta_type
in
\
(
'Document'
,
'DTMLDocument'
,
'DTMLMethod'
,
'ZSQLMethod'
):
url
=
self
.
absolute_url
()
return
'
<d:src>%s</d
:src>
\
n
'
\
'
<d:dst>%s/object_src</d
:dst>'
%
(
url
,
url
)
v
self
=
self
.
v_self
()
if
hasattr
(
vself
,
'meta_type'
)
and
v
self
.
meta_type
in
\
(
'Document'
,
'DTMLDocument'
,
'DTMLMethod'
,
'ZSQLMethod'
):
url
=
v
self
.
absolute_url
()
return
'
\
n
<n:src>%s</n
:src>
\
n
'
\
'
<n:dst>%s/object_src</n
:dst>'
%
(
url
,
url
)
return
''
def
dav__supportedlock
(
self
):
#'<d:lockscope><d:exclusive/></d:lockscope>\n' \
#'<d:locktype><d:write/></d:locktype>\n' \
return
'<d:supportedlock>
\
n
'
\
'<d:lockentry>
\
n
'
\
'</d:lockentry>
\
n
'
\
'</d:supportedlock>
\
n
'
return
'
\
n
<n:lockentry>
\
n
'
\
' <d:lockscope><d:exclusive/></d:lockscope>
\
n
'
\
' <d:locktype><d:write/></d:locktype>
\
n
'
\
' </n:lockentry>
\
n
'
def
dav__lockdiscovery
(
self
):
text
=
[
'<d:lockdiscovery>
\
n
'
]
...
...
@@ -612,9 +582,6 @@ class PropertySheets(Implicit):
default
=
DefaultProperties
()
webdav
=
DAVProperties
()
def
__init__
(
self
,
parent
=
None
):
pass
def
__propsets__
(
self
):
propsets
=
self
.
aq_parent
.
__propsets__
return
(
self
.
default
,
self
.
webdav
)
+
propsets
...
...
@@ -665,7 +632,10 @@ class PropertySheets(Implicit):
for
propset
in
self
.
aq_parent
.
__propsets__
:
if
propset
.
id
!=
name
and
propset
.
xml_namespace
()
!=
name
:
result
.
append
(
propset
)
self
.
aq_parent
.
__propsets__
=
tuple
(
result
)
self
.
parent
.
__propsets__
=
tuple
(
result
)
def
__del__
(
self
):
self
.
parent
=
None
def
__len__
(
self
):
return
len
(
self
.
__propsets__
())
...
...
@@ -702,9 +672,7 @@ class vps(Base):
self
.
c
=
c
def
__of__
(
self
,
parent
):
if
hasattr
(
parent
,
'aq_base'
):
parent
=
parent
.
aq_base
return
self
.
c
(
parent
)
return
self
.
c
().
__of__
(
parent
)
def
absattr
(
attr
):
if
callable
(
attr
):
...
...
lib/python/webdav/xmlcmds.py
View file @
d7005989
...
...
@@ -85,7 +85,7 @@
"""WebDAV xml request objects."""
__version__
=
'$Revision: 1.1
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
4
$'
[
11
:
-
2
]
import
sys
,
os
,
string
from
common
import
absattr
,
aq_base
,
urlfix
...
...
@@ -147,7 +147,6 @@ class PropFind:
davprops
=
DAVProps
(
obj
)
propsets
=
(
davprops
,)
obsheets
=
{
'DAV:'
:
davprops
}
if
self
.
allprop
:
stats
=
[]
for
ps
in
propsets
:
...
...
@@ -179,23 +178,7 @@ class PropFind:
'</d:propstat>
\
n
'
%
(
ns
,
name
,
name
)
result
.
write
(
stat
)
else
:
raise
'Bad Request'
,
'Invalid request'
result
.
write
(
'</d:response>
\
n
'
)
## for ps in obj.propertysheets.values():
## if hasattr(aq_base(ps), 'dav__propstat'):
## propstat=ps.dav__propstat(self.allprop, self.propnames)
## if propstat:
## result.write(propstat)
## needstat=0
## if needstat: result.write('<d:status>200 OK</d:status>\n')
## 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
)
...
...
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