Commit 2df68b5b authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added formal representation of data and mime types so that synchronisation can be supported.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10513 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9a546dab
......@@ -66,6 +66,7 @@ class File(XMLObject, CMFFile):
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Data
)
# Declarative interfaces
......
##############################################################################
#
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
class Data:
"""
This property sheet defines the way to store data (file, images, etc.)
in the form of an object of any type
"""
_properties = (
{ 'id' : 'data',
'description' : 'An object (string, stream, etc.) which contains raw data',
'type' : 'object',
'default' : '',
'mode' : 'w' },
{ 'id' : 'content_type',
'description' : 'A string which represents the mime type of the data',
'type' : 'string',
'default' : 'application/unknown',
'mode' : 'w' },
)
......@@ -100,6 +100,7 @@ class OOoDocument(DMSFile, CachingMixin):
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Data
, PropertySheet.Version
, PropertySheet.Reference
, PropertySheet.Document
......@@ -111,9 +112,12 @@ class OOoDocument(DMSFile, CachingMixin):
rx_strip=re.compile('<[^>]*?>',re.DOTALL|re.MULTILINE)
rx_compr=re.compile('\s+')
searchable_attrs=DMSFile.searchable_attrs+('text_content',)
searchable_attrs=DMSFile.searchable_attrs+('text_content',) # XXX - good idea - should'n this be made more general ?
def _getServerCoordinates(self):
def _getServerCoordinates(self): # XXX - Naming - should be _getServerCoordinate or _getServerCoordinateList
# the reason why plural is not so good is because one never
# knows is plural returns a count (ie. the server has 3 coordinates)
# or if plural returns a list
"""
Returns OOo conversion server data from
preferences
......@@ -275,7 +279,8 @@ class OOoDocument(DMSFile, CachingMixin):
#self.setReference(meta.get('reference',''))
#security.declareProtected(Permissions.View,'getOOfile')
def getOOfile(self):
def getOOfile(self): # We must be consistent - OOoDocument and OOoFile is OK
# XXX OODocument and OOFile is OK
"""
Return the converted OOo document.
......@@ -287,7 +292,8 @@ class OOoDocument(DMSFile, CachingMixin):
return data
security.declareProtected(Permissions.View,'hasOOfile')
def hasOOfile(self):
def hasOOfile(self): # We must be consistent - OOoDocument and OOoFile is OK
# XXX OODocument and OOFile is OK
"""
Checks whether we have an OOo converted file
"""
......
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