[Zope-Checkins] SVN: Zope/trunk/ Merge fix for issue #1219 (fix XML export).

Tres Seaver tseaver at zope.com
Fri Nov 26 13:56:01 EST 2004


Log message for revision 28528:
  Merge fix for issue #1219 (fix XML export).

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Shared/DC/xml/ppml.py

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2004-11-26 18:50:11 UTC (rev 28527)
+++ Zope/trunk/doc/CHANGES.txt	2004-11-26 18:56:01 UTC (rev 28528)
@@ -55,6 +55,8 @@
         so that options with characters that needs shell quoting
         doesn't break the command.
 
+      - Collector #1219:  Make XML export sane again.
+
       - Collector #945:  Allow adding empty PythonScript instances
         programmatically.
 

Modified: Zope/trunk/lib/python/Shared/DC/xml/ppml.py
===================================================================
--- Zope/trunk/lib/python/Shared/DC/xml/ppml.py	2004-11-26 18:50:11 UTC (rev 28527)
+++ Zope/trunk/lib/python/Shared/DC/xml/ppml.py	2004-11-26 18:56:01 UTC (rev 28528)
@@ -167,7 +167,10 @@
         if isinstance(v,Scalar):
             return '%s<%s%s> %s </%s>\n' % (i, name, id, str(v)[:-1], name)
         else:
-            v=v.__str__(indent+2)
+            try:
+                v=v.__str__(indent+2)
+            except TypeError:
+                v=v.__str__()
             return '%s<%s%s>\n%s%s</%s>\n' % (i, name, id, v, i, name)
 
 class Collection:
@@ -215,10 +218,17 @@
     def __len__(self): return len(self._subs)
 
     def append(self, v): self._subs.append(v)
+    def extend(self, v): self._subs.extend(v)
 
+    def _stringify(self, v, indent):
+        try:
+            return v.__str__(indent+2)
+        except TypeError:
+            return v.__str__()
+
     def value(self, indent):
         return string.join(map(
-            lambda v, indent=indent: v.__str__(indent),
+            lambda v, indent=indent: self._stringify(v, indent),
             self._subs),'')
 
 class List(Sequence): pass
@@ -403,12 +413,16 @@
 
     def load_binput(self):
         i = mloads('i' + self.read(1) + '\000\000\000')
-        self.stack[-1].id=self.idprefix+`i`
+        last = self.stack[-1]
+        if getattr(last, 'id', last) is not last:
+            last.id = self.idprefix + `i`
     dispatch[BINPUT] = load_binput
 
     def load_long_binput(self):
         i = mloads('i' + self.read(4))
-        self.stack[-1].id=self.idprefix+`i`
+        last = self.stack[-1]
+        if getattr(last, 'id', last) is not last:
+            last.id = self.idprefix + `i`
     dispatch[LONG_BINPUT] = load_long_binput
 
 



More information about the Zope-Checkins mailing list