Handling unicode encode errors in page/text handling. Also adding upgrade command for fabric when pip is non-trivial.

This commit is contained in:
Samuel Clay 2016-12-05 22:09:05 -08:00
parent 9c463ea264
commit c4830e3e95
3 changed files with 13 additions and 2 deletions

View file

@ -193,7 +193,7 @@ class PageImporter(object):
if response.encoding and response.encoding != 'utf-8':
try:
data = data.encode(response.encoding)
except LookupError:
except (LookupError, UnicodeEncodeError):
pass
if data:

View file

@ -64,7 +64,7 @@ class TextImporter:
if resp.encoding and resp.encoding != 'utf-8':
try:
text = text.encode(resp.encoding)
except LookupError:
except (LookupError, UnicodeEncodeError):
pass
if text:

11
fabfile.py vendored
View file

@ -505,6 +505,17 @@ def pip():
run('pip install --upgrade pip')
run('pip install -r requirements.txt')
sudo('swapoff /swapfile')
def solo_pip(role):
if role == "app":
gunicorn_stop()
pip()
deploy_code(reload=True)
elif role == "task":
celery_stop()
copy_task_settings()
pip()
celery()
# PIL - Only if python-imaging didn't install through apt-get, like on Mac OS X.
def setup_imaging():