Skip to content

Commit

Permalink
Explicitely numbered replacement fields
Browse files Browse the repository at this point in the history
  • Loading branch information
quantifiedcode-bot committed Jan 1, 2016
1 parent 92d1166 commit 9ce766c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
description = 'Transparently use webpack with django',
author = 'Owais Lone',
author_email = 'hello@owaislone.org',
download_url = 'https://github.com/owais/django-webpack-loader/tarball/{}'.format(version),
download_url = 'https://github.com/owais/django-webpack-loader/tarball/{0}'.format(version),
url = 'https://github.com/owais/django-webpack-loader', # use the URL to the github repo
keywords = ['django', 'webpack', 'assets'], # arbitrary keywords
data_files = [("", ["LICENSE"])],
Expand Down
2 changes: 1 addition & 1 deletion tests/app/tests/test_webpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def test_missing_stats_file(self):
try:
get_assets(get_config(DEFAULT_CONFIG))
except IOError as e:
expected = 'Error reading {}. Are you sure webpack has generated the file and the path is correct?'.format(settings.WEBPACK_LOADER[DEFAULT_CONFIG]['STATS_FILE'])
expected = 'Error reading {0}. Are you sure webpack has generated the file and the path is correct?'.format(settings.WEBPACK_LOADER[DEFAULT_CONFIG]['STATS_FILE'])
self.assertIn(expected, str(e))

def test_bad_status_in_production(self):
Expand Down
8 changes: 4 additions & 4 deletions webpack_loader/templatetags/webpack_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

def filter_by_extension(bundle, extension):
for chunk in bundle:
if chunk['name'].endswith('.{}'.format(extension)):
if chunk['name'].endswith('.{0}'.format(extension)):
yield chunk


Expand All @@ -19,9 +19,9 @@ def render_as_tags(bundle):
for chunk in bundle:
url = chunk.get('publicPath') or chunk['url']
if chunk['name'].endswith('.js'):
tags.append('<script type="text/javascript" src="{}"></script>'.format(url))
tags.append('<script type="text/javascript" src="{0}"></script>'.format(url))
elif chunk['name'].endswith('.css'):
tags.append('<link type="text/css" href="{}" rel="stylesheet"/>'.format(url))
tags.append('<link type="text/css" href="{0}" rel="stylesheet"/>'.format(url))
return mark_safe('\n'.join(tags))


Expand All @@ -39,7 +39,7 @@ def render_bundle(bundle_name, extension=None, config='DEFAULT'):

@register.simple_tag
def webpack_static(asset_name, config='DEFAULT'):
return "{}{}".format(
return "{0}{1}".format(
get_assets(get_config(config)).get(
'publicPath', getattr(settings, 'STATIC_URL')
),
Expand Down
2 changes: 1 addition & 1 deletion webpack_loader/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def filter_files(files, config):
filename = F['name']
ignore = any(regex.match(filename) for regex in config['ignores'])
if not ignore:
relpath = '{}{}'.format(config['BUNDLE_DIR_NAME'], filename)
relpath = '{0}{1}'.format(config['BUNDLE_DIR_NAME'], filename)
F['url'] = staticfiles_storage.url(relpath)
yield F

Expand Down

0 comments on commit 9ce766c

Please sign in to comment.