Skip to content
Permalink
Browse files

POC of handling filter failures

  • Loading branch information
ralsina committed Feb 14, 2016
1 parent 7638ac8 commit c05cb992ab609947f11dc9b809b49b0f559aa399
Showing with 17 additions and 6 deletions.
  1. +8 −0 CHANGES.txt
  2. +8 −5 nikola/filters.py
  3. +1 −1 nikola/utils.py
@@ -1,3 +1,11 @@
New in master
=============

Bugfixes
--------

* Mark as out-of-date tasks when filters fail (Issue #2169)

New in v7.7.5
=============

@@ -75,8 +75,11 @@ def f_in_file(fname):
with io.open(fname, 'r', encoding='utf-8') as inf:
data = inf.read()
data = f(data)
with io.open(fname, 'w+', encoding='utf-8') as outf:
outf.write(data)
if data is not False:
with io.open(fname, 'w+', encoding='utf-8') as outf:
outf.write(data)
else:
return False

return f_in_file

@@ -287,16 +290,16 @@ def php_template_injection(data):
def cssminify(data):
"""Minify CSS using http://cssminifier.com/."""
try:
url = 'http://cssminifier.com/raw'
url = 'http://cssminifier.comFOO/raw'
_data = {'input': data}
response = requests.post(url, data=_data)
if response.status_code != 200:
LOGGER.error("can't use cssminifier.com: HTTP status {}", response.status_code)
return data
return False
return response.text
except Exception as exc:
LOGGER.error("can't use cssminifier.com: {}", exc)
return data
return False


@apply_to_text_file
@@ -903,7 +903,7 @@ def filter_matches(ext):
def unlessLink(action, target):
if not os.path.islink(target):
if isinstance(action, Callable):
action(target)
return action(target)
else:
subprocess.check_call(action % target, shell=True)

0 comments on commit c05cb99

Please sign in to comment.