timestamp=False, do_print=True) log("------------------------------------------------", 'MakeNoteQueue-' + currentLog, timestamp=False, do_print=True) timerFull = stopwatch.Timer() for result in pending_queued_items: guid = result['guid'] noteContents = result['contents'] noteTitle = result['title'] line = (" [%-30s] " % ((result['guid']) + ':') ) if result['guid'] else "NEW [%-30s] " % '' success, errors = EN.validateNoteContent(noteContents, noteTitle) validation_status = 1 if success else -1 line = " SUCCESS! " if success else " FAILURE: " line += ' ' if result['guid'] else ' NEW ' # line += ' %-60s ' % (result['title'] + ':') if not success: errors = '\n * ' + '\n * '.join(errors) log(line, 'MakeNoteQueue-' + currentLog, timestamp=False, do_print=True) else: errors = '\n'.join(errors) sql = "UPDATE %s SET validation_status = %d, validation_result = '%s' WHERE " % (
currentLog = 'Pending' log("------------------------------------------------", 'MakeNoteQueue-' + currentLog, timestamp=False, do_print=True, clear=True) log(" CHECKING %3d PENDING MAKE NOTE QUEUE ITEMS " % len(pending_queued_items), 'MakeNoteQueue-' + currentLog, clear=False, timestamp=False, do_print=True) log("------------------------------------------------", 'MakeNoteQueue-' + currentLog, timestamp=False, do_print=True) timerFull = stopwatch.Timer() for result in pending_queued_items: guid = result['guid'] noteContents = result['contents'] noteTitle = result['title'] line = (" [%-30s] " % ((result['guid']) + ':')) if result['guid'] else "NEW [%-30s] " % '' success, errors = EN.validateNoteContent(noteContents, noteTitle) validation_status = 1 if success else -1 line = " SUCCESS! " if success else " FAILURE: " line += ' ' if result['guid'] else ' NEW ' # line += ' %-60s ' % (result['title'] + ':') if not success: errors = '\n * ' + '\n * '.join(errors) log(line, 'MakeNoteQueue-' + currentLog, timestamp=False, do_print=True) else: errors = '\n'.join(errors) sql = "UPDATE %s SET validation_status = %d, validation_result = '%s' WHERE " % ( TABLES.MAKE_NOTE_QUEUE, validation_status, escape_text_sql(errors)) if guid: sql += "guid = '%s'" % guid
line += '\n' + result['validation_result'] l.go(line) l.go("------------------------------------------------\n") l.go(result['contents']) l.go("------------------------------------------------\n") EN = Evernote() tmr = mk_banner('Pending', display_initial_info=True) timerFull = stopwatch.Timer() for result in queued_items[l.default_filename]: guid = result['guid'] noteContents = result['contents'] noteTitle = result['title'] line = (" [%-30s] " % ((result['guid']) + ':')) if result['guid'] else "NEW [%-30s] " % '' errors = tmr.autoStep(EN.validateNoteContent(noteContents, noteTitle), noteTitle) validation_status = 1 if tmr.status.IsSuccess else -1 line = " SUCCESS! " if tmr.status.IsSuccess else " FAILURE: " line += ' ' if result['guid'] else ' NEW ' # line += ' %-60s ' % (result['title'] + ':') l.dump(errors, 'LXML ERRORS', 'lxml_errors', wrap_filename=False, crosspost_to_default=False) if not tmr.status.IsSuccess: if not is_str_type(errors): errors = '\n * ' + '\n * '.join(errors) l.go(line + errors) else: if not is_str_type(errors): errors = '\n'.join(errors) sql = "UPDATE {t} SET validation_status = ?, validation_result = ? WHERE "