Archived
1
0

Fixed __setstate__() methods to update revision.

This commit is contained in:
Dan Helfman 2007-07-17 17:29:47 +00:00
parent 433b3b3915
commit 15d4758766
3 changed files with 13 additions and 7 deletions

View File

@ -7,6 +7,8 @@ from controller.Html_nuker import Html_nuker
class Entry( Persistent ): class Entry( Persistent ):
def __setstate__(self, state): def __setstate__(self, state):
self.__dict__.update(state) self.__dict__.update(state)
if self.__class__ != Note:
self.update_revision()
self.__class__ = Note self.__class__ = Note
""" """

View File

@ -8,10 +8,12 @@ class Note( Persistent ):
if "_Entry__title" in state: if "_Entry__title" in state:
state[ "_Note__title" ] = state[ "_Entry__title" ] state[ "_Note__title" ] = state[ "_Entry__title" ]
del( state[ "_Entry__title" ] ) del( state[ "_Entry__title" ] )
self.update_revision()
if "_Entry__contents" in state: if "_Entry__contents" in state:
state[ "_Note__contents" ] = state[ "_Entry__contents" ] state[ "_Note__contents" ] = state[ "_Entry__contents" ]
del( state[ "_Entry__contents" ] ) del( state[ "_Entry__contents" ] )
self.__dict__ = state self.update_revision()
self.__dict__.update( state )
""" """
An single textual wiki note. An single textual wiki note.

View File

@ -8,9 +8,11 @@ class Notebook( Persistent ):
if "_Notebook__entries" in state: if "_Notebook__entries" in state:
state[ "_Notebook__notes" ] = state[ "_Notebook__entries" ] state[ "_Notebook__notes" ] = state[ "_Notebook__entries" ]
del( state[ "_Notebook__entries" ] ) del( state[ "_Notebook__entries" ] )
self.update_revision()
if "_Notebook__startup_entries" in state: if "_Notebook__startup_entries" in state:
state[ "_Notebook__startup_notes" ] = state[ "_Notebook__startup_entries" ] state[ "_Notebook__startup_notes" ] = state[ "_Notebook__startup_entries" ]
del( state[ "_Notebook__startup_entries" ] ) del( state[ "_Notebook__startup_entries" ] )
self.update_revision()
self.__dict__.update(state) self.__dict__.update(state)
""" """
@ -43,7 +45,7 @@ class Notebook( Persistent ):
def add_note( self, note ): def add_note( self, note ):
""" """
Add an note to this notebook. Add a note to this notebook.
@type note: Note @type note: Note
@param note: note to add @param note: note to add
@ -54,7 +56,7 @@ class Notebook( Persistent ):
def remove_note( self, note ): def remove_note( self, note ):
""" """
Remove an note from this notebook. Remove a note from this notebook.
@type note: Note @type note: Note
@param note: note to remove @param note: note to remove
@ -118,7 +120,7 @@ class Notebook( Persistent ):
def add_startup_note( self, note ): def add_startup_note( self, note ):
""" """
Add the given note to be shown on startup. It must already be an note in this notebook. Add the given note to be shown on startup. It must already be a note in this notebook.
@type note: unicode @type note: unicode
@param note: note to be added for startup @param note: note to be added for startup