#NEWLINE# def load_note_attribs( item , time_control_default ) : #NEWLINE# #INDENT# logger . debug ( 'loading note attributes %s %s' , item . id , item . name ) #NEWLINE# found_directive = False #NEWLINE# if ( item . note != None ) : #NEWLINE# #INDENT# for line in item . note . get_note_lines ( ) : #NEWLINE# #INDENT# found_directive = process_line_for_directives ( item , line , found_directive ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( not found_directive ) and ( len ( time_control_default . strip ( ) ) > 0 ) ) : #NEWLINE# #INDENT# found_directive = process_line_for_directives ( item , time_control_default , found_directive ) #NEWLINE# #UNINDENT# if found_directive : #NEWLINE# #INDENT# logger . debug ( 'attributes for %s are %s' , item . id , item . attribs ) #NEWLINE# if ( 'onstart' in item . attribs ) : #NEWLINE# #INDENT# item . date_due = item . date_to_start #NEWLINE# #UNINDENT# if ( 'ondue' in item . attribs ) : #NEWLINE# #INDENT# item . date_to_start = item . date_due #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# if ( 'start' in item . attribs ) : #NEWLINE# #INDENT# bits = item . attribs [ 'start' ] . split ( ':' ) #NEWLINE# the_date = item . date_to_start #NEWLINE# if ( len ( bits ) == 2 ) : #NEWLINE# #INDENT# item . date_to_start = datetime ( the_date . year , the_date . month , the_date . day , int ( bits [ 0 ] ) , int ( bits [ 1 ] ) , 0 , 0 , the_date . tzinfo ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . error ( 'problem parsing cal directives, start malformed: %s %s' , item . id , item . name ) #NEWLINE# #UNINDENT# #UNINDENT# if ( 'due' in item . attribs ) : #NEWLINE# #INDENT# bits = item . attribs [ 'due' ] . split ( ':' ) #NEWLINE# the_date = item . date_due #NEWLINE# if ( len ( bits ) == 2 ) : #NEWLINE# #INDENT# item . date_due = datetime ( the_date . year , the_date . month , the_date . day , int ( bits [ 0 ] ) , int ( bits [ 1 ] ) , 0 , 0 , the_date . tzinfo ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# logger . error ( 'problem parsing cal directives, due malformed: %s %s' , item . id , item . name ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# logger . error ( e . message ) #NEWLINE# logger . error ( 'problem parsing cal directives: %s %s' , item . id , item . name ) #NEWLINE# #UNINDENT# if ( item . date_to_start > item . date_due ) : #NEWLINE# #INDENT# logger . error ( 'problem parsing cal directives, the start date is after the due date: %s %s' , item . id , item . name ) #NEWLINE# item . date_to_start = item . date_due #NEWLINE# #UNINDENT# logger . debug ( 'final dates for %s are start:%s due:%s' , item . id , item . date_to_start , item . date_due )