diff --git a/product/ERP5/Document/File.py b/product/ERP5/Document/File.py index 05bfe50a82c18c792c8b99630a457598a6371432..96f286d21581876f6d999226645c7b7e8930b175 100644 --- a/product/ERP5/Document/File.py +++ b/product/ERP5/Document/File.py @@ -66,6 +66,7 @@ class File(XMLObject, CMFFile): property_sheets = ( PropertySheet.Base , PropertySheet.CategoryCore , PropertySheet.DublinCore + , PropertySheet.Data ) # Declarative interfaces diff --git a/product/ERP5/PropertySheet/Data.py b/product/ERP5/PropertySheet/Data.py new file mode 100644 index 0000000000000000000000000000000000000000..b296f27f4c6346d2f4401b660d2cb213d9fedc0b --- /dev/null +++ b/product/ERP5/PropertySheet/Data.py @@ -0,0 +1,46 @@ +############################################################################## +# +# 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' }, + ) diff --git a/product/ERP5OOo/Document/OOoDocument.py b/product/ERP5OOo/Document/OOoDocument.py index b026363f597c5c47672c4e640f6a980048fa5895..7bf1be68022d9e47602680d437ce218b6665f425 100644 --- a/product/ERP5OOo/Document/OOoDocument.py +++ b/product/ERP5OOo/Document/OOoDocument.py @@ -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 """