This repository has been archived by the owner. It is now read-only.
Browse files

Use numbers in field names in format strings because of Python 2.6

  • Loading branch information...
1 parent 7310b82 commit 4059af974c969e6dc6d70567ee69c94065bbec69 @bkabrda bkabrda committed Dec 4, 2013
Showing with 10 additions and 10 deletions.
  1. +7 −7 devassistant/
  2. +3 −3 devassistant/
@@ -654,42 +654,42 @@ def _try_obtain_mandatory_params(cls, args):
data = {}
if 'data' in args and isinstance(args['data'], dict):
data = args['data']
- logger.debug('Template context data: {}'.format(data))
+ logger.debug('Template context data: {0}'.format(data))
return (template, cls._make_output_file_name(args, template), data)
def run(cls, c):
# Transform list of dicts (where keys are unique) into a single dict
args = c.format_deep(True)
- logger.debug('args={}'.format(repr(args)))
+ logger.debug('args={0}'.format(repr(args)))
# Get parameters
template, result_filename, data = cls._try_obtain_mandatory_params(args)
# Create an environment!
- logger.debug('Using templats dir: {}'.format(c.files_dir))
+ logger.debug('Using templats dir: {0}'.format(c.files_dir))
env = jinja2.Environment(loader=jinja2.FileSystemLoader(c.files_dir))
env.trim_blocks = True
env.lstrip_blocks = True
# Get a template instance
tpl = None
- logger.debug('Using template file: {}'.format(template))
+ logger.debug('Using template file: {0}'.format(template))
tpl = env.get_template(template)
except jinja2.TemplateError as e:
- raise exceptions.CommandException('Template file failure: {}'.format(e.message))
+ raise exceptions.CommandException('Template file failure: {0}'.format(e.message))
# Check if destination file exists, overwrite if needed
if os.path.exists(result_filename):
overwrite = args['overwrite'] if 'overwrite' in args else False
overwrite = True if overwrite == 'True' or overwrite == 'true' or overwrite == 'yes' else False
if overwrite:
-'Overwriting the destination file {}'.format(result_filename))
+'Overwriting the destination file {0}'.format(result_filename))
- raise exceptions.CommandException('The destination file already exists: {}'.format(result_filename))
+ raise exceptions.CommandException('The destination file already exists: {0}'.format(result_filename))
# Generate an output file finally...
with open(result_filename, 'w') as out:
@@ -231,10 +231,10 @@ class symbol_base(object):
first = second = None
def nud(self):
- raise SyntaxError("Syntax error ({}).".format(
+ raise SyntaxError("Syntax error ({0}).".format(
def led(self, left):
- raise SyntaxError("Unknown operator ({}).".format(
+ raise SyntaxError("Unknown operator ({0}).".format(
def symbol(self, id, bp=0):
@@ -261,7 +261,7 @@ def advance(self, id=None):
if id and != id:
- raise SyntaxError("Expected {}".format(id))
+ raise SyntaxError("Expected {0}".format(id))
self.token =
def method(self, symbol_name):

2 comments on commit 4059af9


zaufi replied Dec 4, 2013

is this something for Python 2 compatibility?
(I use Python3 only, so just curious)


bkabrda replied Dec 4, 2013

Yeah, it's for Python 2.6 (we want DevAssistant to work on RHEL 6) - when I wrote a test for the Jinja command runner, this crashed in Travis:

Please sign in to comment.