self.description_summary = "" def characters(self, ch): if self.description_summary_tag: self.description_summary += ch.replace(" ", "") def endElement(self, name): if name == 'Description_Summary' and self.weakness_tag: self.description_summary_tag = False self.description_summary = self.description_summary + self.description_summary self.cwe[-1]['description_summary'] = self.description_summary.replace("\n", "") elif name == 'Weakness': self.weakness_tag = False # dictionary cwedict = Configuration.getCWEDict() # make parser parser = make_parser() ch = CWEHandler() parser.setContentHandler(ch) # check modification date try: f = Configuration.getFile(cwedict) except: sys.exit("Cannot open url %s. Bad URL or not connected to the internet?"%(cwedict)) lastmodified = parse_datetime(f.headers['last-modified'], ignoretz=True) i = db.getLastModified('cwe') if i is not None: if lastmodified == i: print("Not modified")
if self.description_summary_tag: self.description_summary += ch.replace(" ", "") def endElement(self, name): if name == 'Description_Summary' and self.weakness_tag: self.description_summary_tag = False self.description_summary = self.description_summary + self.description_summary self.cwe[-1][ 'description_summary'] = self.description_summary.replace( "\n", "") elif name == 'Weakness': self.weakness_tag = False # dictionary cwedict = Configuration.getCWEDict() # make parser parser = make_parser() ch = CWEHandler() parser.setContentHandler(ch) # check modification date try: f = Configuration.getFile(cwedict) except: sys.exit("Cannot open url %s. Bad URL or not connected to the internet?" % (cwedict)) lastmodified = parse_datetime(f.headers['last-modified'], ignoretz=True) i = db.getLastModified('cwe') if i is not None: if lastmodified == i: