[Zope-Checkins] CVS: Zope2 - PropertySheets.py:1.63.4.9

andreas@serenade.digicool.com andreas@serenade.digicool.com
Tue, 10 Apr 2001 16:14:54 -0400


Update of /cvs-repository/Zope2/lib/python/OFS
In directory serenade.digicool.com:/tmp/cvs-serv32452/lib/python/OFS

Modified Files:
      Tag: zope-2_3-branch
	PropertySheets.py 
Log Message:
Replaced former fix for Collector #2150 by a patch from Martijn



--- Updated File PropertySheets.py in package Zope2 --
--- PropertySheets.py	2001/04/10 19:02:31	1.63.4.8
+++ PropertySheets.py	2001/04/10 20:14:53	1.63.4.9
@@ -375,14 +375,6 @@
             else:
                 # Quote non-xml items here?
                 attrs='' 
-
-            # remove some empty properties to be send to clients
-            # that can't handle this in a proper way (GoLIVE)
-            # (ajung, Collector #2150)
-
-            if name in ['getlastmodified','getcontenttype'] \
-                and len(value)==0:  continue
-
             prop='  <n:%s%s>%s</n:%s>' % (name, attrs, value, name)
             result.append(prop)
         if not result: return ''
@@ -536,7 +528,6 @@
     pm=({'id':'creationdate',     'mode':'r'},
         {'id':'displayname',      'mode':'r'},
         {'id':'resourcetype',     'mode':'r'},
-        {'id':'getlastmodified',  'mode':'r'},
         {'id':'getcontenttype',   'mode':'r'},
         {'id':'getcontentlength', 'mode':'r'},
         {'id':'source',           'mode':'r'},
@@ -558,6 +549,9 @@
         raise ValueError, '%s cannot be deleted.' % id
 
     def _propertyMap(self):
+        # Only use getlastmodified if returns a value
+        if hasattr(self.v_self(), '_p_mtime'):
+            return self.pm + ({'id':'getlastmodified',  'mode':'r'},)
         return self.pm
     
     def propertyMap(self):
@@ -577,10 +571,7 @@
         return ''
 
     def dav__getlastmodified(self):
-        vself=self.v_self()
-        if hasattr(vself, '_p_mtime'):
-            return rfc1123_date(vself._p_mtime)
-        return ''
+        return rfc1123_date(self.v_self()._p_mtime)
 
     def dav__getcontenttype(self):
         vself=self.v_self()