Permalink
Browse files

Changing all format strings to be python 2.6 compatible

  • Loading branch information...
1 parent 196c513 commit 68df3d47fff08898028e2961c2daefbe52e72c27 @kelvl kelvl committed Oct 18, 2012
Showing with 13 additions and 13 deletions.
  1. +1 −1 debug_shadow.conf.py
  2. +3 −3 shadow.conf.py
  3. +6 −6 src/shadow/proxy/web.py
  4. +1 −1 src/shadow/services/proxy.py
  5. +2 −2 src/shadow/services/ui.py
@@ -57,7 +57,7 @@
'results': {
'class': 'logging.FileHandler',
'formatter': 'default_pywsgi_access_fix',
- "filename": os.path.join(file_prefix, "{}-results.log".format(program_name))
+ "filename": os.path.join(file_prefix, "{program_name!r}-results.log".format(program_name=program_name))
}
},
'loggers': {
View
@@ -57,17 +57,17 @@
'ui': {
'class': 'logging.FileHandler',
'formatter': 'default',
- "filename": os.path.join(file_prefix, "{}-ui.log".format(program_name))
+ "filename": os.path.join(file_prefix, "{program_name!r}-ui.log".format(program_name=program_name))
},
'proxy': {
'class': 'logging.FileHandler',
'formatter': 'default',
- "filename": os.path.join(file_prefix, "{}-proxy.log".format(program_name))
+ "filename": os.path.join(file_prefix, "{program_name!r}-proxy.log".format(program_name=program_name))
},
'results': {
'class': 'logging.FileHandler',
'formatter': 'default_pywsgi_access_fix',
- "filename": os.path.join(file_prefix, "{}-results.log".format(program_name))
+ "filename": os.path.join(file_prefix, "{program_name!r}-results.log".format(program_name=program_name))
}
},
'loggers': {
@@ -36,13 +36,13 @@ def __init__(self, service,
super(ProxyFlask, self).__init__(__name__)
if len(old_servers) == 0:
- raise ProxyConfigError("At least 1 old server must be specified, old servers: {}". format(old_servers))
+ raise ProxyConfigError("At least 1 old server must be specified, old servers: {old_servers!r}". format(old_servers=old_servers))
if len(new_servers) == 0:
- raise ProxyConfigError("At least 1 new server mush be specified, new server: {}".format(new_servers))
+ raise ProxyConfigError("At least 1 new server mush be specified, new server: {new_servers!r}".format(new_servers=new_servers))
if not all([isinstance(x, AbstractResultsLogger) for x in result_loggers]):
- raise ProxyConfigError("result_loggers must all be sub-classes of AbstractResultsLogger: {}".format(result_loggers))
+ raise ProxyConfigError("result_loggers must all be sub-classes of AbstractResultsLogger: {result_loggers!r}".format(result_loggers=result_loggers))
self.old_servers = old_servers
self.new_servers = new_servers
@@ -69,12 +69,12 @@ def __init__(self, service,
})
def log_result(self, result):
- logger.debug('Logging results: {}'.format(result))
+ logger.debug('Logging results: {result!r}'.format(result=result))
for results_log in self.result_loggers:
try:
results_log.log_result(result)
except Exception:
- logger.exception("Results Logger: {} encountered exception logging result: {}".format(results_log, result))
+ logger.exception("Results Logger: {results_log!r} encountered exception logging result: {result!r}".format(results_log=results_log, result=result))
def format_response(self, response, elapsed_time=None):
resp = None
@@ -138,7 +138,7 @@ def timer(self, timed_func, *args, **kwargs):
logger.exception("Exception encountered in time step")
result = e
elapsed = time.time() - start
- logger.info("Timed request [{}] with args {}, {}".format(elapsed, args, kwargs))
+ logger.info("Timed request [{elapsed!r}] with args {args!r}, {kwargs!r}".format(elapsed=elapsed, args=args, kwargs=kwargs))
return (result, elapsed)
def catch_all(self, path):
@@ -28,7 +28,7 @@ class ProxyService(Service):
new_servers_additional_get_params = settings.get('proxy', {}).get('new_servers_additional_get_params', [])
def do_start(self):
- logger.info("Starting ProxyService on {}:{}".format(self.address, self.port))
+ logger.info("Starting ProxyService on {address!r}:{port!r}".format(address=self.address, port=self.port))
def do_stop(self):
logger.info("Stopping ProxyService")
@@ -17,7 +17,7 @@ class UIService(Service):
port = settings.get('ui', {}).get('port', 9000)
def broadcast_message(self, event, args, ns_name=''):
- logger.debug("Broadcasting Event: {} Data: {}".format(event, args))
+ logger.debug("Broadcasting Event: {event!r} Data: {args!r}".format(event=event, args=args))
try:
socket_server = self.server
except Exception:
@@ -30,7 +30,7 @@ def broadcast_message(self, event, args, ns_name=''):
socket.send_packet(pkt)
def do_start(self):
- logger.info("Starting UIService on {}:{}".format(self.address, self.port))
+ logger.info("Starting UIService on {address!r}:{port!r}".format(address=self.address, port=self.port))
def do_stop(self):
logger.info("Stopping UIService")

0 comments on commit 68df3d4

Please sign in to comment.