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
62ae26da
Commit
62ae26da
authored
Mar 03, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various DAV fixups.
parent
20d8ecdd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
85 deletions
+45
-85
lib/python/OFS/PropertySheets.py
lib/python/OFS/PropertySheets.py
+45
-85
No files found.
lib/python/OFS/PropertySheets.py
View file @
62ae26da
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
##############################################################################
##############################################################################
"""Property sheets"""
"""Property sheets"""
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
import
time
,
string
,
App
.
Management
import
time
,
string
,
App
.
Management
from
ZPublisher.Converters
import
type_converters
from
ZPublisher.Converters
import
type_converters
...
@@ -177,8 +177,7 @@ class PropertySheet(Persistent, Implicit):
...
@@ -177,8 +177,7 @@ class PropertySheet(Persistent, Implicit):
if
not
self
.
valid_property_id
(
id
):
if
not
self
.
valid_property_id
(
id
):
raise
'Bad Request'
,
'Invalid property id.'
raise
'Bad Request'
,
'Invalid property id.'
self
=
self
.
v_self
()
self
=
self
.
v_self
()
if
meta
is
None
:
if
meta
is
None
:
meta
=
{}
meta
=
{}
prop
=
{
'id'
:
id
,
'type'
:
type
,
'meta'
:
meta
}
prop
=
{
'id'
:
id
,
'type'
:
type
,
'meta'
:
meta
}
self
.
_properties
=
self
.
_properties
+
(
prop
,)
self
.
_properties
=
self
.
_properties
+
(
prop
,)
setattr
(
self
,
id
,
value
)
setattr
(
self
,
id
,
value
)
...
@@ -235,108 +234,69 @@ class PropertySheet(Persistent, Implicit):
...
@@ -235,108 +234,69 @@ class PropertySheet(Persistent, Implicit):
dict
[
p
[
'id'
]]
=
p
dict
[
p
[
'id'
]]
=
p
return
dict
return
dict
def
dav__propstat
(
self
,
allprop
,
val
s
,
join
=
string
.
join
):
def
dav__propstat
(
self
,
allprop
,
name
s
,
join
=
string
.
join
):
# The dav__propstat method returns a chunk of xml containing
# The dav__propstat method returns a chunk of xml containing
# one or more propstat elements indicating property names,
# one or more propstat elements indicating property names,
# values, errors and status codes. This is called by some
# values, errors and status codes. This is called by some
# of the WebDAV support machinery. If a property set does
# of the WebDAV support machinery. If a property set does
# not support WebDAV,
just override this method to return
# not support WebDAV,
this method should return an empty
#
an empty
string.
# string.
propstat
=
'<d:propstat
%s
>
\
n
'
\
propstat
=
'<d:propstat
xmlns:ps="%s"
>
\
n
'
\
' <d:prop>
\
n
'
\
' <d:prop>
\
n
'
\
'%s
\
n
'
\
'%
%
s
\
n
'
\
' </d:prop>
\
n
'
\
' </d:prop>
\
n
'
\
' <d:status>HTTP/1.1 %s</d:status>
\
n
'
\
' <d:status>HTTP/1.1 %%s</d:status>
\
n
%%s'
\
'</d:propstat>
\
n
'
'</d:propstat>
\
n
'
%
self
.
xml_namespace
()
errormsg
=
' <d:responsedescription>%s</d:responsedescription>
\
n
'
result
=
[]
result
=
[]
if
not
self
.
propertyMap
():
if
not
allprop
and
not
names
:
return
''
if
not
allprop
and
not
vals
:
# propname request
# propname request
for
name
in
self
.
propertyIds
():
for
name
in
self
.
propertyIds
():
result
.
append
(
' <ns0:%s/>'
%
name
)
result
.
append
(
' <ps:%s/>'
%
name
)
if
not
result
:
return
''
result
=
join
(
result
,
'
\
n
'
)
result
=
join
(
result
,
'
\
n
'
)
nsdef
=
' xmlns:ns0="%s"'
%
self
.
xml_namespace
()
return
propstat
%
(
result
,
'200 OK'
,
''
)
return
propstat
%
(
nsdef
,
result
,
'200 OK'
)
elif
allprop
:
elif
allprop
:
for
name
,
value
in
self
.
propertyItems
():
for
item
in
self
.
propertyMap
():
prop
=
' <ns0:%s>%s</ns0:%s>'
%
(
name
,
value
,
name
)
name
,
type
=
item
[
'id'
],
item
.
get
(
'type'
,
'string'
)
meta
=
item
.
get
(
'meta'
,
{})
value
=
self
.
getProperty
(
name
)
if
type
==
'tokens'
:
value
=
join
(
value
,
' '
)
elif
type
==
'lines'
:
value
=
join
(
value
,
'
\
n
'
)
if
meta
.
get
(
'dav_xml'
,
0
):
prop
=
value
else
:
prop
=
' <ps:%s>%s</ps:%s>'
%
(
name
,
value
,
name
)
result
.
append
(
prop
)
result
.
append
(
prop
)
if
not
result
:
return
''
result
=
join
(
result
,
'
\
n
'
)
result
=
join
(
result
,
'
\
n
'
)
nsdef
=
' xmlns:ns0="%s"'
%
self
.
xml_namespace
()
return
propstat
%
(
result
,
'200 OK'
,
''
)
return
propstat
%
(
nsdef
,
result
,
'200 OK'
)
else
:
else
:
xml_ns
=
self
.
xml_namespace
()
propdict
=
self
.
propdict
()
propdict
=
self
.
propdict
()
nsdef
=
' xmlns:ns0="%s"'
%
self
.
xml_namespace
()
xml_id
=
self
.
xml_namespace
()
for
name
,
ns
in
val
s
:
for
name
,
ns
in
name
s
:
if
ns
==
xml_
ns
:
if
ns
==
xml_
id
:
if
propdict
.
has_key
(
name
):
if
not
propdict
.
has_key
(
name
):
value
=
self
.
getProperty
(
name
)
prop
=
' <ps:%s/>'
%
name
prop
=
' <ns0:%s>%s</ns0:%s>'
%
(
name
,
value
,
name
)
emsg
=
errormsg
%
'No such property: %s'
%
name
result
.
append
(
propstat
%
(
nsdef
,
prop
,
'200 OK'
))
result
.
append
(
propstat
%
(
prop
,
'404 Not Found'
,
emsg
))
else
:
else
:
prop
=
' <ns0:%s/>'
%
name
item
=
propdict
[
name
]
result
.
append
(
propstat
%
(
nsdef
,
prop
,
'404 Not Found'
))
name
,
type
=
item
[
'id'
],
item
.
get
(
'type'
,
'string'
)
return
join
(
result
,
'
\
n
'
)
meta
=
item
.
get
(
'meta'
,
{})
value
=
self
.
getProperty
(
name
)
def
odav__propstat
(
self
,
url
,
allprop
,
vals
,
iscol
,
join
=
string
.
join
):
# The dav__propstat method returns an xml response element
# containing one or more propstats indicating property names,
# values, errors and status codes.
result
=
[]
propstat
=
'<d:propstat>
\
n
'
\
'<d:prop%s>
\
n
'
\
'%s
\
n
'
\
'</d:prop>
\
n
'
\
'<d:status>HTTP/1.1 %s</d:status>
\
n
'
\
'</d:/propstat>'
if
not
allprop
and
not
vals
:
if
hasattr
(
aq_base
(
self
),
'propertyMap'
):
for
md
in
self
.
propertyMap
():
prop
=
'<z:%s/>'
%
md
[
'id'
]
result
.
append
(
propstat
%
(
''
,
prop
,
'200 OK'
))
elif
allprop
:
if
hasattr
(
aq_base
(
self
),
'propertyMap'
):
for
md
in
self
.
propertyMap
():
name
,
type
=
md
[
'id'
],
md
.
get
(
'type'
,
'string'
)
value
=
getattr
(
self
,
name
)
if
type
==
'tokens'
:
value
=
join
(
value
,
' '
)
elif
type
==
'lines'
:
value
=
join
(
value
,
'
\
n
'
)
else
:
value
=
str
(
value
)
prop
=
'<z:%s>%s</z:%s>'
%
(
name
,
value
,
name
)
result
.
append
(
propstat
%
(
''
,
prop
,
'200 OK'
))
else
:
prop_mgr
=
hasattr
(
aq_base
(
self
),
'propertyMap'
)
for
name
,
ns
in
vals
:
if
ns
==
zpns
:
if
not
prop_mgr
or
not
self
.
hasProperty
(
name
):
prop
=
'<z:%s/>'
%
name
result
.
append
(
propstat
%
(
''
,
prop
,
'404 Not Found'
))
else
:
value
=
getattr
(
self
,
name
)
type
=
self
.
getPropertyType
(
name
)
if
type
==
'tokens'
:
if
type
==
'tokens'
:
value
=
join
(
value
,
' '
)
value
=
join
(
value
,
' '
)
elif
type
==
'lines'
:
elif
type
==
'lines'
:
value
=
join
(
value
,
'
\
n
'
)
value
=
join
(
value
,
'
\
n
'
)
else
:
value
=
str
(
value
)
if
meta
.
get
(
'dav_xml'
,
0
):
prop
=
'<z:%s>%s</z:%s>'
%
(
name
,
value
,
name
)
prop
=
value
result
.
append
(
propstat
%
(
''
,
prop
,
'200 OK'
))
else
:
prop
=
' <ps:%s>%s</ps:%s>'
%
(
name
,
value
,
name
)
else
:
result
.
append
(
propstat
%
(
prop
,
'200 OK'
,
''
))
prop
=
'<n:%s/>'
%
name
if
not
result
:
return
''
ns
=
' xmlns:n="%s"'
%
ns
return
join
(
result
,
''
)
result
.
append
(
propstat
%
(
ns
,
prop
,
'404 Not Found'
))
result
=
'<d:response>
\
n
'
\
'<d:href>%s</d:href>
\
n
'
\
'%s
\
n
'
\
'</d:response>'
%
(
url
,
join
(
result
,
'
\
n
'
))
return
result
# Web interface
# Web interface
...
...
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