continue (fhdr,numbered_findings,fob) = AuditParser("\n".join(findings)).parse() (fdhdr,numbered_finding_details,fdob) = AuditParser(d1+'\n\n'+d2).parse(fob) exd_observations = [] exd_observations.append(fdhdr) exd_observations.extend(numbered_finding_details) #Check for numeric matches - code matched as Cond3 if( numbered_findings and numbered_finding_details and len(numbered_findings) == len(numbered_finding_details)): numbered_findings[0] = fhdr + "\n" + numbered_findings[0] numbered_finding_details[0] = fdhdr + "\n" + numbered_finding_details[0] for i in range(len(numbered_findings)): ar.write_row(rx+1,id,cat,FINDING_TYPE, numbered_findings[i] , numbered_finding_details[i],cause,"Cond3: Numeric match") elif numbered_findings and (not numbered_finding_details or len(numbered_findings) != len(numbered_finding_details)): numbered_findings[0] = fhdr + "\n" + numbered_findings[0] for find in numbered_findings: ar.write_row(rx+1,id,cat,FINDING_TYPE,fhdr + find,u"".join(exd_observations),cause,"Cond2.1") elif not numbered_findings: ar.write_row(rx+1,id,cat,FINDING_TYPE,fhdr,u"".join(exd_observations),cause,"Cond1") else: #Cond4 - no such match. Dump findings and finding details and notify ar.write_row(rx+1,id,cat,FINDING_TYPE,finding,(d1 + "\n" + d2),cause,"Cond4: Neelansha Please look at it!") if fob and not fdob: ar.write_row(rx+1,id,cat,OBSERV_TYPE,fob,d1 + "\n" + d2,cause,"Cond5.1 observ") elif fob and fdob: ar.write_row(rx+1,id,cat,OBSERV_TYPE,fob,fdob,cause,"Cond5 observ")
findingdetail2 = sheet.cell_value(rowx=rx,colx=6) #Column G, row=rx id = sheet.cell_value(rowx=rx,colx=1) #Column B, row=rx cat = sheet.cell_value(rowx=rx,colx=2), #Column C, row=rx cause = sheet.cell_value(rowx=rx,colx=8), #Column I findings = finding.strip().splitlines(); #strip all extra whitespaces and new lines d1 = findingdetail1.strip() #remove leading whitespace d2 = findingdetail2.strip() #remove leading whitespace if d1.lower() == 'n/a' or d1.strip() == '' : d1 = '' if d2.lower() == 'n/a'or d2.strip() == '' : d2 = '' except: logging.exception("Error reading, row: " + str(rx)) #try to write row back ar.write_row(rx+1,id,"ERROR","ERROR",finding,unicode(findingdetail1)+"\n" + unicode(findingdetail2),cause,"Cond4: Neelansha Madam. Please look" + str(sys.exc_info())) logging.exception(unicode(findingdetail1)+"\n" + unicode(findingdetail2)) continue (fhdr,numbered_findings,fob) = AuditParser("\n".join(findings)).parse() (fdhdr,numbered_finding_details,fdob) = AuditParser(d1+'\n\n'+d2).parse(fob) exd_observations = [] exd_observations.append(fdhdr) exd_observations.extend(numbered_finding_details) #Check for numeric matches - code matched as Cond3 if( numbered_findings and numbered_finding_details and len(numbered_findings) == len(numbered_finding_details)): numbered_findings[0] = fhdr + "\n" + numbered_findings[0] numbered_finding_details[0] = fdhdr + "\n" + numbered_finding_details[0]