From e04ae65069734d6d678b06bb3b46263993f4bf92 Mon Sep 17 00:00:00 2001
From: Julien Muchembled <jm@nexedi.com>
Date: Fri, 29 Oct 2010 10:05:39 +0000
Subject: [PATCH] exportXML: add comments about random failures when
 DemoStorage is used

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39674 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/patches/XMLExportImport.py | 7 +++++++
 product/ERP5Type/patches/ppml.py            | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/patches/XMLExportImport.py b/product/ERP5Type/patches/XMLExportImport.py
index b95aadf8f6..0200daf6f0 100644
--- a/product/ERP5Type/patches/XMLExportImport.py
+++ b/product/ERP5Type/patches/XMLExportImport.py
@@ -177,6 +177,13 @@ def XMLrecord(oid, plen, p, id_mapping):
 XMLExportImport.XMLrecord = XMLrecord
 
 def exportXML(jar, oid, file=None):
+    # XXX: For performance reasons, we should change XMLExportImport/ppml code
+    #      so that we can call reorderPickle and XMLrecord only once.
+    #      This means we should be able to do a real export immediately.
+    #      This would also fix random failures when DemoStorage is used,
+    #      because oids can have values that have a shorter representation
+    #      in 'repr' instead of 'base64' (see ppml.convert) and ppml.String
+    #      does not support this.
 
     if file is None: file=TemporaryFile()
     elif type(file) is StringType: file=open(file,'w+b')
diff --git a/product/ERP5Type/patches/ppml.py b/product/ERP5Type/patches/ppml.py
index d7b1ffa071..fc02827de3 100644
--- a/product/ERP5Type/patches/ppml.py
+++ b/product/ERP5Type/patches/ppml.py
@@ -140,7 +140,9 @@ class String(Scalar):
                 v = self.mapping.convertBase64(v)
             else:
                 # Make sure we never produce this kind of xml output
-                raise
+                # XXX: In fact, this can happen when DemoStorage is used
+                #      See notes in XMLExportImport.exportXML
+                raise NotImplementedError
         id = ''
         encoding=''
         if hasattr(self, 'encoding'):
-- 
2.30.9