Commit 335b4edd authored by 's avatar

*** empty log message ***

parent e82c919e
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Property sheets""" """Property sheets"""
__version__='$Revision: 1.1 $'[11:-2] __version__='$Revision: 1.2 $'[11:-2]
import time, string import time, string
from ZPublisher.Converters import type_converters from ZPublisher.Converters import type_converters
...@@ -182,14 +182,12 @@ class PropertySheet(Persistent, Implicit): ...@@ -182,14 +182,12 @@ class PropertySheet(Persistent, Implicit):
def propertyValues(self): def propertyValues(self):
# Return a list of property values. # Return a list of property values.
vself=self.v_self() return map(lambda i, s=self: s.getProperty(i['id']),
return map(lambda i,s=vself: s.getProperty(i['id']),
self.propertyMap()) self.propertyMap())
def propertyItems(self): def propertyItems(self):
# Return a list of (id, property) tuples. # Return a list of (id, property) tuples.
vself=self.v_self() return map(lambda i, s=self: (i['id'], s.getProperty(i['id'])),
return map(lambda i,s=vself: (i['id'], s.getProperty(i['id'])),
self.propertyMap()) self.propertyMap())
def propertyInfo(self, id): def propertyInfo(self, id):
...@@ -211,14 +209,19 @@ class PropertySheet(Persistent, Implicit): ...@@ -211,14 +209,19 @@ class PropertySheet(Persistent, Implicit):
def dav__propstat(self, url, allprop, vals, join=string.join): def dav__propstat(self, url, allprop, vals, 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. # values, errors and status codes. This is called by some
# of the WebDAV support machinery. If a property set does
# not support WebDAV, just override this method to return
# an empty string.
propstat='<d:propstat%s>\n' \ propstat='<d:propstat%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' \
'</d:propstat>' '</d:propstat>'
result=[] result=[]
if not self.propertyMap():
return ''
if not allprop and not vals: if not allprop and not vals:
# propname request # propname request
for name in self.propertyIds(): for name in self.propertyIds():
...@@ -454,7 +457,7 @@ class PropertySheets(Implicit): ...@@ -454,7 +457,7 @@ class PropertySheets(Implicit):
for propset in self.__propsets__(): for propset in self.__propsets__():
if propset.id==name: if propset.id==name:
return propset.__of__(self) return propset.__of__(self)
raise 'Not Found', name return getattr(self, name)
def __getitem__(self, n): def __getitem__(self, n):
return self.__propsets__()[n].__of__(self) return self.__propsets__()[n].__of__(self)
...@@ -468,8 +471,8 @@ class PropertySheets(Implicit): ...@@ -468,8 +471,8 @@ class PropertySheets(Implicit):
def manage_addPropertySheet(self, id, ns): def manage_addPropertySheet(self, id, ns):
""" """ """ """
md={'xmlns':ns} md={'xmlns':ns}
ps=PropertySet(id, md) ps=PropertySheet(id, md)
self.addPropertySet(ps) self.addPropertySheet(ps)
return 'OK' return 'OK'
def addPropertySheet(self, propset): def addPropertySheet(self, propset):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment