plint

French poetry validator (local mirror of https://gitlab.com/a3nm/plint)
git clone https://a3nm.net/git/plint/
Log | Files | Refs | README

commit ba3148814d209813a3cefd06fb53e1cb7d9a0e6d
parent 8355392b1ab8c73d37931f17527d29aa38ccffb0
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Tue, 20 Mar 2012 01:28:34 +0100

don't crash on missing Accept-Language

Diffstat:
plint_web.py | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plint_web.py b/plint_web.py @@ -34,7 +34,10 @@ def best_match(matches, header): def get_locale(): header = request.headers.get('Accept-Language') print(header) - return best_match(['fr', 'en'], header) + try: + return best_match(['fr', 'en'], header) + except AttributeError: + return 'en' def get_title(): if get_locale() == 'fr':