[Zope-Checkins] CVS: Zope/lib/python/OFS - PropertyManager.py:1.56 PropertySheets.py:1.93

Tres Seaver tseaver at zope.com
Thu Jan 15 17:50:18 EST 2004


Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv20971

Modified Files:
	PropertyManager.py PropertySheets.py 
Log Message:


  - CGI escape merge (from 2.6 / 2.7 audit).

  - Store 'lines' and 'tokens' properties as tuples, not lists (merge from
    2.6 / 2.7 audit).


=== Zope/lib/python/OFS/PropertyManager.py 1.55 => 1.56 ===
--- Zope/lib/python/OFS/PropertyManager.py:1.55	Tue Nov 18 08:17:03 2003
+++ Zope/lib/python/OFS/PropertyManager.py	Thu Jan 15 17:50:17 2004
@@ -23,7 +23,7 @@
 from Globals import Persistent
 from zExceptions import BadRequest
 from cgi import escape
-
+from types import ListType
 
 
 class PropertyManager(ExtensionClass.Base, ZDOM.ElementWithAttributes):
@@ -157,6 +157,8 @@
 
     def _setPropValue(self, id, value):
         self._wrapperCheck(value)
+        if type(value) == ListType:
+            value = tuple(value)
         setattr(self,id,value)
 
     def _delPropValue(self, id):
@@ -337,7 +339,7 @@
             if (not 'd' in propdict[id].get('mode', 'wd')) or (id in nd):
                 return MessageDialog(
                 title  ='Cannot delete %s' % id,
-                message='The property <em>%s</em> cannot be deleted.' % id,
+                message='The property <em>%s</em> cannot be deleted.' % escape(id),
                 action ='manage_propertiesForm')
             self._delProperty(id)
 


=== Zope/lib/python/OFS/PropertySheets.py 1.92 => 1.93 ===
--- Zope/lib/python/OFS/PropertySheets.py:1.92	Tue Nov 18 08:17:03 2003
+++ Zope/lib/python/OFS/PropertySheets.py	Thu Jan 15 17:50:17 2004
@@ -15,7 +15,7 @@
 
 __version__='$Revision$'[11:-2]
 
-import time,  App.Management, Globals
+import time,  App.Management, Globals, sys
 from webdav.WriteLockInterface import WriteLockInterface
 from ZPublisher.Converters import type_converters
 from Globals import DTMLFile, MessageDialog
@@ -30,7 +30,7 @@
 from webdav.common import isDavCollection
 from zExceptions import BadRequest, Redirect
 from cgi import escape
-
+from types import ListType
 
 # DM: we would like to import this from somewhere
 BadRequestException= 'Bad Request'
@@ -214,6 +214,10 @@
             prop['select_variable']=value
             if type=='selection': value=None
             else: value=[]
+
+        # bleah - can't change kw name in api, so use ugly workaround.
+        if sys.modules['__builtin__'].type(value) == ListType:
+            value = tuple(value)
         setattr(self, id, value)
 
     def _updateProperty(self, id, value, meta=None):
@@ -238,6 +242,9 @@
                 if prop['id']==id: prop['meta']=meta
                 props.append(prop)
             pself._properties=tuple(props)
+
+        if type(value) == ListType:
+            value = tuple(value)
         setattr(self.v_self(), id, value)
 
     def _delProperty(self, id):




More information about the Zope-Checkins mailing list