Commit da2119cc authored by Sebastien Robin's avatar Sebastien Robin

no modification of cps is needed now


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@328 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 30613722
......@@ -73,9 +73,6 @@ class PatchedProxyBase(ProxyBase):
'id' : 'docid',
'type' : 'string'
},
# { 'id' : 'workflow_history', # XXX Added for ERP5 SyncML
# 'type' : 'pickle'
# },
{
'id' : 'default_language',
'type' : 'string'
......
......@@ -19,9 +19,15 @@
from Products.CPSDocument.CPSDocument import CPSDocument
from Products.CPSSchemas.BasicFields import CPSImageField, CPSFileField, CPSDateTimeField
from Products.ERP5Type.Base import Base
from Products.ERP5Type.Utils import UpperCase
from Acquisition import aq_base, aq_inner
from AccessControl import ClassSecurityInfo
from Products.CMFCore.CMFCorePermissions import View
class PatchedCPSDocument(CPSDocument):
security = ClassSecurityInfo()
def _propertyMap(self):
"""
Returns fake property sheet
......@@ -36,19 +42,19 @@ class PatchedCPSDocument(CPSDocument):
f_type = p['type']
if isinstance(field,CPSImageField):
#f_type = 'image'
f_type = 'pickle'
f_type = 'object'
if isinstance(field,CPSDateTimeField):
f_type = 'date'
if isinstance(field,CPSFileField):
#f_type = 'file'
f_type = 'pickle'
f_type = 'object'
if isinstance(field,CPSDocument):
#f_type = 'document'
f_type = 'pickle'
f_type = 'object'
prop_id = schema.getIdUnprefixed(field.id)
if prop_id in ('file_text','content','attachedFile',
'attachedFile_html','attachedFile_text', 'content'):
f_type = 'pickle' # this should be string, but this strings
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 not (prop_id in ('content',)):
......@@ -61,7 +67,32 @@ class PatchedCPSDocument(CPSDocument):
)
return tuple(property_sheet + list(getattr(self, '_local_properties', ())))
security.declareProtected( View, 'getProperty' )
def getProperty(self, key, d=None):
"""
Previous Name: getValue
Generic accessor. Calls the real accessor
"""
accessor_name = 'get' + UpperCase(key)
aq_self = aq_base(self)
if hasattr(aq_self, accessor_name):
method = getattr(self, accessor_name)
return method()
prop_type = self.getPropertyType(key) # XXX added by Seb
if prop_type in ('object',):
if hasattr(aq_self, key):
value = getattr(aq_self, key)
value = aq_base(value)
return value
return None
elif hasattr(aq_self, key):
value = getattr(aq_self, key)
if callable(value): value = value()
return value
CPSDocument.getProperty = PatchedCPSDocument.getProperty
CPSDocument._propertyMap = PatchedCPSDocument._propertyMap
CPSDocument.getProperty = Base.getProperty
CPSDocument.setProperty = Base.setProperty
CPSDocument.asXML = Base.asXML
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment