[Erp5-report] r45890 arnaud.fontaine - /slapos/trunk/util/slapos.tool.nosqltester/src/slapo...

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jun 15 07:31:58 CEST 2011


Author: arnaud.fontaine
Date: Wed Jun 15 07:31:57 2011
New Revision: 45890

URL: http://svn.erp5.org?rev=45890&view=rev
Log:
Cosmetics.

Modified:
    slapos/trunk/util/slapos.tool.nosqltester/src/slapos/tool/nosqltester/__init__.py

Modified: slapos/trunk/util/slapos.tool.nosqltester/src/slapos/tool/nosqltester/__init__.py
URL: http://svn.erp5.org/slapos/trunk/util/slapos.tool.nosqltester/src/slapos/tool/nosqltester/__init__.py?rev=45890&r1=45889&r2=45890&view=diff
==============================================================================
--- slapos/trunk/util/slapos.tool.nosqltester/src/slapos/tool/nosqltester/__init__.py [utf8] (original)
+++ slapos/trunk/util/slapos.tool.nosqltester/src/slapos/tool/nosqltester/__init__.py [utf8] Wed Jun 15 07:31:57 2011
@@ -35,8 +35,7 @@ import sys, os, getopt, bz2
 import urllib, urllib2
 import logging, logging.handlers
 
-class NoSQLTester:
-
+class NoSQLTester(object):
   def __init__(self, params):
     self.params = params
     self.childpid = -1
@@ -79,9 +78,7 @@ class NoSQLTester:
 
     @app.route('/action', methods=['POST'])
     def action():
-      if request.method == 'POST' and \
-         'action' in request.form:
-        
+      if request.method == 'POST' and 'action' in request.form:
         if request.form['action'] == 'START':
           pid = os.fork()
           
@@ -108,7 +105,9 @@ class NoSQLTester:
   def send_result_availability_notification(self, filename):
     values = {}
     values['filename'] = filename
-    values['url'] = "http://"+self.params['address']+":"+str(self.params['port'])+"/result/"+filename
+    values['url'] = "http://%s:%d/result/%s" % (self.params['address'],
+                                                self.params['port'],
+                                                filename)
     values['compress_method'] = self.params['compress_method']
     
     if self.params['compress_method'] != None:
@@ -116,18 +115,21 @@ class NoSQLTester:
     
     data = urllib.urlencode(values)
     try:
-      f = urllib2.urlopen("http://"+self.params['host_address']+":"+str(self.params['host_port'])+"/report", data)
+      f = urllib2.urlopen("http://%s:%d/report" % (self.params['host_address'],
+                                                   self.params['host_port']),
+                          data)
       f.close()
     except:
       self.logger.debug(Formatter().formatException(sys.exc_info()))
 
   def run_tester(self):
-    command = self.params['binary']
-    command += " > " + os.path.join(self.params['report_path'],self.params['report_filename'])
+    command = "%s > %s" % (self.params['binary'],
+                           os.path.join(self.params['report_path'],
+                                        self.params['report_filename']))
 
     result = os.WEXITSTATUS(os.system(command))
     if result == 127:
-      raise ValueError, 'Command not found: %r' % (command, )
+      raise ValueError, 'Command not found: %r' % command
 
     if result == 0:
       self.send_result_availability_notification(self.params['report_filename'])



More information about the Erp5-report mailing list