[Oval-commits] r57 - in trunk/tools: . oval/parser

Pavel Vinogradov blaze-guest at alioth.debian.org
Sun Jun 24 16:03:29 UTC 2007


Author: blaze-guest
Date: 2007-06-24 16:03:29 +0000 (Sun, 24 Jun 2007)
New Revision: 57

Modified:
   trunk/tools/oval/parser/dsa.py
   trunk/tools/oval/parser/wml.py
   trunk/tools/parse-dsa-oval.py
Log:
Fix input data decoding problem.
Remove unused locale staff.

Modified: trunk/tools/oval/parser/dsa.py
===================================================================
--- trunk/tools/oval/parser/dsa.py	2007-06-17 13:37:57 UTC (rev 56)
+++ trunk/tools/oval/parser/dsa.py	2007-06-24 16:03:29 UTC (rev 57)
@@ -1,6 +1,5 @@
 import re
 import os
-import locale
 import logging
 
 # Format of data files is:
@@ -31,7 +30,7 @@
 	dsaFile = open(path)
 	
 	for line in dsaFile:
-		line = line.decode(locale.getpreferredencoding())
+		line= line.decode ("ISO-8859-2")
 		datepatern = re.compile (r'report_date>([\d-]+)</define-tag>')
 		result = datepatern.search (line)
 		if result:

Modified: trunk/tools/oval/parser/wml.py
===================================================================
--- trunk/tools/oval/parser/wml.py	2007-06-17 13:37:57 UTC (rev 56)
+++ trunk/tools/oval/parser/wml.py	2007-06-24 16:03:29 UTC (rev 57)
@@ -3,7 +3,6 @@
 import re
 import os
 import sys
-import locale
 import logging
 
 # Format of wml files is:
@@ -31,10 +30,7 @@
 		wmlFile = open(path)
 		
 		for line in wmlFile:
-			try:
-				line = line.decode(locale.getpreferredencoding())
-			except:
-				line = line.decode("koi8-r")
+			line= line.decode ("ISO-8859-2")
 				
 			descrpatern = re.compile (r'description>(.*?)</define-tag>')
 			result = descrpatern.search (line)
@@ -75,4 +71,4 @@
 			break
 		result += "\n" + par
 	
-	return result
\ No newline at end of file
+	return result

Modified: trunk/tools/parse-dsa-oval.py
===================================================================
--- trunk/tools/parse-dsa-oval.py	2007-06-17 13:37:57 UTC (rev 56)
+++ trunk/tools/parse-dsa-oval.py	2007-06-24 16:03:29 UTC (rev 57)
@@ -9,7 +9,6 @@
 # -*- coding: utf-8 -*-                                                                                                                                               
 import os
 import sys
-import locale
 import getopt
 import logging
 
@@ -77,7 +76,6 @@
 
 if __name__ == "__main__":
     
-    locale.setlocale(locale.LC_ALL, "")
     # Parse cmd options with getopt
     opts = {}
     




More information about the Oval-commits mailing list