#NEWLINE# def update_date( self , now ) : #NEWLINE# #INDENT# if isinstance ( now , datetime ) : #NEWLINE# #INDENT# today = now . date ( ) #NEWLINE# self . last_datetime = now #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( now , date ) : #NEWLINE# #INDENT# today = now #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'now must be datetime or date' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( self . ntype == 'd' ) : #NEWLINE# #INDENT# self . next_date = ( today + timedelta ( days = 1 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( today . ntype == 'w' ) : #NEWLINE# #INDENT# self . next_date = ( today + timedelta ( days = ( 7 - today . weekday ( ) ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . ntype == 'm' ) : #NEWLINE# #INDENT# self . next_date = ( today + timedelta ( days = ( ( calendar . mdays [ today . month ] - today . day ) + 1 ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . save ( )