[Zope3-checkins] SVN: Zope3/trunk/ Fixed bug #98307: PROPFIND with a unicode ID fails

Dmitry Vasiliev dima at hlabs.spb.ru
Tue Apr 24 11:38:01 EDT 2007


Log message for revision 74705:
  Fixed bug #98307: PROPFIND with a unicode ID fails

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/app/dav/tests/test_propfind.py
  U   Zope3/trunk/src/zope/app/dav/widget.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2007-04-24 14:45:32 UTC (rev 74704)
+++ Zope3/trunk/doc/CHANGES.txt	2007-04-24 15:38:00 UTC (rev 74705)
@@ -18,6 +18,8 @@
 
     Bugs fixed
 
+      - #98307: PROPFIND with a unicode ID fails
+
       - Password managers now accept full Unicode characters range for
         passwords
 

Modified: Zope3/trunk/src/zope/app/dav/tests/test_propfind.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/tests/test_propfind.py	2007-04-24 14:45:32 UTC (rev 74704)
+++ Zope3/trunk/src/zope/app/dav/tests/test_propfind.py	2007-04-24 15:38:00 UTC (rev 74705)
@@ -331,13 +331,13 @@
         root = self.rootFolder
         zpt = traverse(root, 'zpt')
         dc = IZopeDublinCore(zpt)
-        dc.title = u'Test Title'
+        dc.title = u'Test Title \N{COPYRIGHT SIGN}'
         req = '''<prop xmlns:DC="http://www.purl.org/dc/1.1">
         <DC:title />
         </prop>'''
 
         expect = '''<prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0">Test Title</title></prop>'''
+        <title xmlns="a0">Test Title \xc2\xa9</title></prop>'''
         self._checkPropfind(zpt, req, expect)
 
     def test_davpropdccreated(self):
@@ -355,12 +355,12 @@
         root = self.rootFolder
         zpt = traverse(root, 'zpt')
         dc = IZopeDublinCore(zpt)
-        dc.subjects = (u'Bla', u'Ble', u'Bli')
+        dc.subjects = (u'Bla', u'Ble', u'Bli', u'\N{COPYRIGHT SIGN}')
         req = '''<prop xmlns:DC="http://www.purl.org/dc/1.1">
         <DC:subjects /></prop>'''
 
         expect = '''<prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <subjects xmlns="a0">%s</subjects></prop>''' % u', '.join(dc.subjects)
+        <subjects xmlns="a0">Bla, Ble, Bli, \xc2\xa9</subjects></prop>'''
         self._checkPropfind(zpt, req, expect)
 
     def test_davpropname(self):

Modified: Zope3/trunk/src/zope/app/dav/widget.py
===================================================================
--- Zope3/trunk/src/zope/app/dav/widget.py	2007-04-24 14:45:32 UTC (rev 74704)
+++ Zope3/trunk/src/zope/app/dav/widget.py	2007-04-24 15:38:00 UTC (rev 74705)
@@ -27,6 +27,7 @@
 from zope.app.form import InputWidget
 from zope.interface import implements
 
+
 class DAVWidget(InputWidget):
 
     implements(IDAVWidget)
@@ -37,12 +38,9 @@
     def getInputValue(self):
         return self._data
 
-    def __str__(self):
-        return str(self._data)
-
     def __call__(self):
-        return str(self)
-    
+        return unicode(self._data)
+
     def setRenderedValue(self, value):
         if isinstance(value, minidom.Node):
             text = u''
@@ -51,23 +49,26 @@
                     continue
                 text += node.nodeValue
             value = text
-        
+
         super(DAVWidget, self).setRenderedValue(value)
 
+
 class TextDAVWidget(DAVWidget):
 
     implements(ITextDAVWidget)
 
+
 class SequenceDAVWidget(DAVWidget):
 
     implements(ISequenceDAVWidget)
 
-    def __str__(self):
+    def __call__(self):
         return u', '.join(self._data)
-    
+
     def getInputValue(self):
         return [v.strip() for v in self._data.split(',')]
 
+
 class XMLDAVWidget(DAVWidget):
 
     implements(IXMLDAVWidget)
@@ -75,13 +76,10 @@
     def getInputValue(self):
         return self._data
 
-    def __str__(self):
-        raise ValueError("xmldavwidget is not a string.")
-
     def __call__(self):
         return self._data
 
     def setRenderedValue(self, value):
         if not isinstance(value, minidom.Node):
-            value = ''
+            value = u''
         self._data = value



More information about the Zope3-Checkins mailing list