Commit 75ad9443 authored by Ivan Tyagov's avatar Ivan Tyagov

Remove Snapshot implementation.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37180 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 50eb451a
...@@ -67,7 +67,6 @@ class Acknowledgement(EmailDocumentProxyMixin, Event): ...@@ -67,7 +67,6 @@ class Acknowledgement(EmailDocumentProxyMixin, Event):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.Document , PropertySheet.Document
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.Snapshot
, PropertySheet.Task , PropertySheet.Task
, PropertySheet.Url , PropertySheet.Url
, PropertySheet.Arrow , PropertySheet.Arrow
......
...@@ -82,48 +82,6 @@ DEFAULT_QUALITY = 75 ...@@ -82,48 +82,6 @@ DEFAULT_QUALITY = 75
DEFAULT_CONTENT_TYPE = 'text/html' DEFAULT_CONTENT_TYPE = 'text/html'
class SnapshotMixin:
"""
This class provides a generic API to store in the ZODB
PDF snapshots of objects and documents with the
goal to keep a facsimile copy of documents as they
were at a given date.
"""
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
security.declareProtected(Permissions.ModifyPortalContent, 'createSnapshot')
def createSnapshot(self):
"""
Create a snapshot (PDF). This is the normal way to modifiy
snapshot_data. Once a snapshot is taken, a new snapshot
can not be taken.
NOTE: use getSnapshotData and hasSnapshotData accessors
to access a snapshot.
NOTE2: implementation of createSnapshot should probably
be delegated to a types base method since this it
is configuration dependent.
"""
if self.hasSnapshotData():
raise ConversionError('This document already has a snapshot.')
self._setSnapshotData(self.convert(format='pdf'))
security.declareProtected(Permissions.ManagePortal, 'deleteSnapshot')
def deleteSnapshot(self):
"""
Deletes the snapshot - in theory this should never be done.
It is there for programmers and system administrators.
"""
try:
del(self.snapshot_data)
except AttributeError:
pass
class ConversionError(Exception):pass class ConversionError(Exception):pass
class DocumentProxyError(Exception):pass class DocumentProxyError(Exception):pass
...@@ -132,8 +90,7 @@ class NotConvertedError(Exception):pass ...@@ -132,8 +90,7 @@ class NotConvertedError(Exception):pass
allow_class(NotConvertedError) allow_class(NotConvertedError)
class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixIn, CachedConvertableMixin, class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixIn, CachedConvertableMixin,
SnapshotMixin, CrawableMixin, TextConvertableMixin, CrawableMixin, TextConvertableMixin, DownloadableMixin, DocumentMixin):
DownloadableMixin, DocumentMixin):
"""Document is an abstract class with all methods related to document """Document is an abstract class with all methods related to document
management in ERP5. This includes searchable text, explicit relations, management in ERP5. This includes searchable text, explicit relations,
implicit relations, metadata, versions, languages, etc. implicit relations, metadata, versions, languages, etc.
...@@ -334,7 +291,6 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixIn, CachedCo ...@@ -334,7 +291,6 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixIn, CachedCo
, PropertySheet.ExternalDocument , PropertySheet.ExternalDocument
, PropertySheet.Url , PropertySheet.Url
, PropertySheet.Periodicity , PropertySheet.Periodicity
, PropertySheet.Snapshot
) )
index_html = DownloadableMixin.index_html index_html = DownloadableMixin.index_html
......
...@@ -145,7 +145,6 @@ class EmailDocument(TextDocument): ...@@ -145,7 +145,6 @@ class EmailDocument(TextDocument):
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.Version , PropertySheet.Version
, PropertySheet.Document , PropertySheet.Document
, PropertySheet.Snapshot
, PropertySheet.ExternalDocument , PropertySheet.ExternalDocument
, PropertySheet.Url , PropertySheet.Url
, PropertySheet.TextDocument , PropertySheet.TextDocument
......
...@@ -116,7 +116,6 @@ class Event(EmailDocument, Movement, AcknowledgeableMixin): ...@@ -116,7 +116,6 @@ class Event(EmailDocument, Movement, AcknowledgeableMixin):
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.Document , PropertySheet.Document
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.Snapshot
, PropertySheet.Task , PropertySheet.Task
, PropertySheet.Url , PropertySheet.Url
, PropertySheet.TextDocument , PropertySheet.TextDocument
......
...@@ -67,7 +67,6 @@ class TextDocument(CachedConvertableMixin, BaseConvertableFileMixin, ...@@ -67,7 +67,6 @@ class TextDocument(CachedConvertableMixin, BaseConvertableFileMixin,
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.Version , PropertySheet.Version
, PropertySheet.Document , PropertySheet.Document
, PropertySheet.Snapshot
, PropertySheet.ExternalDocument , PropertySheet.ExternalDocument
, PropertySheet.Url , PropertySheet.Url
, PropertySheet.TextDocument , PropertySheet.TextDocument
......
##############################################################################
#
# 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 Snapshot:
"""
This property sheet defines the way to store data (file, images, etc.)
in the form of an object of any type
"""
_properties = (
{ 'id' : 'snapshot_data',
'description' : 'An object (string, stream, etc.) which contains raw data'
'of a snapshot. Snapshot is used to keep a visual representation'
'of a document such as an invoice.',
'type' : 'data',
'write_permission' : 'Manage properties',
'default' : '',
'mode' : 'w' },
{ 'id' : 'snapshot_content_type',
'description' : 'A string which represents the mime type of the snapshot data',
'type' : 'string',
'default' : 'application/pdf',
'mode' : 'w' },
)
...@@ -145,7 +145,6 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -145,7 +145,6 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.Version , PropertySheet.Version
, PropertySheet.Document , PropertySheet.Document
, PropertySheet.Snapshot
, PropertySheet.ExternalDocument , PropertySheet.ExternalDocument
, PropertySheet.Url , PropertySheet.Url
, PropertySheet.Periodicity , PropertySheet.Periodicity
......
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