Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle error downloading bootswatch, fixes #2054
  • Loading branch information
ralsina committed Sep 10, 2015
1 parent acf5fb7 commit b8cf5dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -16,6 +16,7 @@ Features
Bugfixes
--------

* Handle error downloading bootswatches (Issue #2054)
* Monitor plugins/ in ``nikola auto`` (Issue #2044)
* Multi-lingual and multi-level directories confused section slug
detection (Issue #2023)
Expand Down
6 changes: 5 additions & 1 deletion nikola/plugins/command/bootswatch_theme.py
Expand Up @@ -96,7 +96,11 @@ def _execute(self, options, args):
url += '/' + version
url = '/'.join((url, swatch, fname))
LOGGER.info("Downloading: " + url)
data = requests.get(url).text
r = requests.get(url)
if r.status_code > 299:
LOGGER.error('Error {} getting {}', r.status_code, url)
exit(1)
data = r.text
with open(os.path.join('themes', name, 'assets', 'css', fname),
'wb+') as output:
output.write(data.encode('utf-8'))
Expand Down

0 comments on commit b8cf5dd

Please sign in to comment.