Home | Trees | Indices | Help |
|
---|
|
1 # ============================================================================= 2 # 3 # Copyright (C) 2007-2008 Conceptive Engineering bvba. All rights reserved. 4 # www.conceptive.be / project-camelot@conceptive.be 5 # 6 # This file is part of the Camelot Library. 7 # 8 # This file may be used under the terms of the GNU General Public 9 # License version 2.0 as published by the Free Software Foundation 10 # and appearing in the file LICENSE.GPL included in the packaging of 11 # this file. Please review the following information to ensure GNU 12 # General Public Licensing requirements will be met: 13 # http://www.trolltech.com/products/qt/opensource.html 14 # 15 # If you are unsure which license is appropriate for your use, please 16 # review the following information: 17 # http://www.trolltech.com/products/qt/licensing.html or contact 18 # project-camelot@conceptive.be. 19 # 20 # This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 21 # WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 22 # 23 # For use of this library in commercial applications, please contact 24 # project-camelot@conceptive.be 25 # 26 # ============================================================================= 27 28 """Set of classes to keep track of changes to objects and 29 be able to restore their state 30 """ 31 32 from camelot.model import * 33 from authentication import getCurrentPerson, Person 34 __metadata__ = metadata 35 36 from camelot.view.elixir_admin import EntityAdmin 37 import datetime40 """Keeps information on the previous state of objects, to keep track 41 of changes and enable restore to that previous state""" 42 using_options(tablename='memento') 43 model = Field(Unicode(256), index=True, required=True) 44 primary_key = Field(INT(), index=True, required=True) 45 creation_date = Field(DateTime(), default=datetime.datetime.now) 46 person = ManyToOne('Person', required=True, ondelete='restrict', onupdate='cascade') 47 48 description = property(lambda self:'Change') 495551 name = 'History' 52 section = 'configuration' 53 list_display = ['creation_date', 'person', 'model', 'primary_key', 'description'] 54 list_filter = ['model']57 """The state of the object before an update took place""" 58 using_options(inheritance='multi', tablename='memento_update',) 59 previous_attributes = Field(PickleType()) 60 61 @property6963 return 'Update %s when previous value was %s'%(','.join(self.previous_attributes.keys()), ','.join(str(v) for v in self.previous_attributes.values()))6471 """The state of the object before it is deleted""" 72 using_options(inheritance='multi', tablename='memento_delete',) 73 previous_attributes = Field(PickleType()) 74 75 @property 788385 """Marks the creation of an object""" 86 using_options(inheritance='multi', tablename='memento_create',) 87 88 @property 9196
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jan 31 18:50:04 2009 | http://epydoc.sourceforge.net |