Commits

Akihiro Itou committed bca6471 Draft

use ast.literal_eval instead of eval

Comments (0)

Files changed (1)

hudsontracplus/HudsonTracPlus/HudsonTracPlusPlugin.py

 import calendar
 import urllib2
 import urlparse
+import ast
 from datetime import datetime
 from trac.core import *
 from trac.config import Option, BoolOption, ListOption
             
             hudson_api_url = self.hudson_url + 'api/python'
             try:
-                hudson_json = eval(self.url_opener.open(hudson_api_url).readline())
+                hudson_json = ast.literal_eval(self.url_opener.open(hudson_api_url).readline())
             except:
                 self.env.log.debug("hudson_api_url='%s'" % (hudson_api_url))
                 return
 
                 job_api_url = get_job_url(job['url'] + 'api/python?depth=2&tree=builds[timestamp,result,url,number,description]', self.hudson_url)
                 try:
-                    json = eval(self.url_opener.open(job_api_url).readline())
+                    json = ast.literal_eval(self.url_opener.open(job_api_url).readline())
                 except:
                     self.env.log.debug("job_api_url='%s'" % (job_api_url))
                     raise