示例#1
0
 def _delete(self, existing_nodes, parent):
     for match in existing_nodes:
         logger.info("Deleting node \"%s\" on line %s" % (match.name, match.lineNo()))
         comment_node = libxml2.newComment(" Removed by update-server-xml.py: %s " % str(match))
         match.addNextSibling(comment_node)
         match.unlinkNode()
         match.freeNode()
示例#2
0
 def _delete(self, existing_nodes, parent):
     for match in existing_nodes:
         logger.info("Deleting %s on line %s" % (match.name, match.lineNo()))
         comment_node = libxml2.newComment(" Removed by update-server-xml.py: %s " % str(match))
         match.addNextSibling(comment_node)
         match.unlinkNode()
         match.freeNode()
示例#3
0
				record.type = e.type
				record.found = False
				record.alternatives = []
				shelf[heading] = record
		
		except MultipleMatchesException, m:
			if verbose:
				os.sys.stderr.write(str(m)) 
			if annotate:
				content = os.linesep + "Possible URIs:" + os.linesep
				for alt in m.items:
					# we need to replace "--" in headings in comments so that the 
					# the doc stays well-formed
					content += alt[0].replace("--", "-\-") + " : " + \
					alt[1].replace("--", "-\-") + os.linesep 
				comment = libxml2.newComment(content)
				node.addNextSibling(comment)
			if log: # TODO: test this
				logging.basicConfig(filename=LOG_FILENAME,level=logging.INFO,format=LOG_FORMAT)
				content = os.linesep + "Possible URIs:" + os.linesep
				for alt in m.items:
					content += alt[0].replace("--", "-\-") + " : " + \
					alt[1].replace("--", "-\-") + os.linesep 
				logging.info(content)
			if not heading in shelf:
				# We still want to put this in the db
				record = Heading()
				record.value = m.heading
				record.type = m.type
				record.found = True
				record.alternatives = m.items