From cfffbdc78d0630b16824cdf6831b3a8dc317ed74 Mon Sep 17 00:00:00 2001
From: Kevin Deldycke <kevin@nexedi.com>
Date: Tue, 27 Jan 2004 10:19:27 +0000
Subject: [PATCH] don't display inside the xml CPSDocuments

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@352 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5CPS/CPSDocumentPatch.py | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/product/ERP5CPS/CPSDocumentPatch.py b/product/ERP5CPS/CPSDocumentPatch.py
index 31d9cbb855..0fae2a2237 100755
--- a/product/ERP5CPS/CPSDocumentPatch.py
+++ b/product/ERP5CPS/CPSDocumentPatch.py
@@ -18,6 +18,7 @@
 
 from Products.CPSDocument.CPSDocument import CPSDocument
 from Products.CPSSchemas.BasicFields import CPSImageField, CPSFileField, CPSDateTimeField
+from Products.CPSSchemas.BasicFields import CPSStringField
 from Products.ERP5Type.Base import Base
 from Products.ERP5Type.Utils import UpperCase
 from Acquisition import aq_base, aq_inner
@@ -36,29 +37,28 @@ class PatchedCPSDocument(CPSDocument):
     for schema in self.getTypeInfo().getSchemas():
       for field in schema.objectValues():
         #LOG('testjp',0,'field: %s' % str(field))
-        f_type = ''
+        f_type = None
         for p in field._properties:
           if p['id'] == 'default':
             f_type = p['type']
         if isinstance(field,CPSImageField):
-          #f_type = 'image'
           f_type = 'object'
-        if isinstance(field,CPSDateTimeField):
+        elif isinstance(field,CPSStringField):
+          f_type = 'string'
+        elif isinstance(field,CPSDateTimeField):
           f_type = 'date'
-        if isinstance(field,CPSFileField):
-          #f_type = 'file'
-          f_type = 'object'
-        if isinstance(field,CPSDocument):
-          #f_type = 'document'
+        elif isinstance(field,CPSFileField):
           f_type = 'object'
+        elif isinstance(field,CPSDocument):
+          pass
         prop_id = schema.getIdUnprefixed(field.id)
-        if prop_id in ('file_text','content','attachedFile',
-                              'attachedFile_html','attachedFile_text', 'content'):
-          f_type = 'object' # this should be string, but this strings
+        #if prop_id in ('file_text','content','attachedFile',
+        #                      'attachedFile_html','attachedFile_text', 'content'):
+        #  f_type = 'object' # this should be string, but this strings
                             # do so bad xml
         #if not (prop_id in ('file_text','content','attachedFile','attachedFile_html','attachedFile_text')):
-        #if 1:
-        if not (prop_id in ('content',)):
+        #if not (prop_id in ('content',)):
+        if f_type is not None:
           property_sheet.append(
             {
               'id'    :   prop_id,
-- 
2.30.9