eggification
[PlinnDocument.git] / Products / PlinnDocument / HistoryAdapters.py
1 # -*- coding: utf-8 -*-
2 #######################################################################################
3 # Plinn - http://plinn.org #
4 # Copyright © 2005-2009 Benoît PIN <benoit.pin@ensmp.fr> #
5 # #
6 # This program is free software; you can redistribute it and/or #
7 # modify it under the terms of the GNU General Public License #
8 # as published by the Free Software Foundation; either version 2 #
9 # of the License, or (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program; if not, write to the Free Software #
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #
19 #######################################################################################
20 """
21 Adapter to plug PlinnDocument to historycal interface.
22
23 $Id: HistoryAdapters.py 647 2009-06-30 12:55:44Z pin $
24 $URL: http://svn.cri.ensmp.fr/svn/PlinnDocument/branches/CMF-2.1/HistoryAdapters.py $
25 """
26
27 from Globals import InitializeClass
28 from AccessControl import ClassSecurityInfo
29 from Products.CMFCore.permissions import ModifyPortalContent
30 from Products.Plinn.HistoryAdapters import DocumentHistory
31
32 class PlinnDocumentHistory(DocumentHistory) :
33
34 security = ClassSecurityInfo()
35
36 security.declareProtected(ModifyPortalContent, 'restore')
37 def restore(self, key):
38 rev = self.getHistoricalRevisionByKey(key)[0]
39 self._content.edit(rev.Format(), rev.XMLBody())
40
41 InitializeClass(PlinnDocumentHistory)