Fix pep8 errors

- E722 do not use bare 'except'

  Replace bare except clauses with explicit exception types.

- E741 ambiguous variable name 'l'

  Rename 'l' to 'locale'

In addition this patch squashes 684782 to use older
werkzeug version to not face with exceptions.

Generally this patch fixes lodgeit CI.

Also, add tox jobs to in-tree zuul config

These were defined in project-config, but we don't need to manage
that centrally.

Change-Id: Id750715472f88fa5dba0a2414fb1667df4a6dc40
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
This commit is contained in:
David Pursehouse 2019-06-20 12:28:47 +09:00 committed by Monty Taylor
parent ab592381b0
commit 2d4b0ebee6
6 changed files with 17 additions and 6 deletions

10
.zuul.yaml Normal file
View File

@ -0,0 +1,10 @@
- project:
check:
jobs:
- tox-pep8
- tox-py27
gate:
jobs:
- tox-pep8
- tox-py27

View File

@ -13,5 +13,5 @@ import subprocess
try:
lodgeit_version = subprocess.check_output(['git', 'rev-parse', 'HEAD'])[:7]
except:
except Exception:
lodgeit_version = ""

View File

@ -64,10 +64,10 @@ def list_languages():
os.path.isdir(os.path.join(folder, filename)):
continue
try:
l = Locale.parse(filename)
locale = Locale.parse(filename)
except UnknownLocaleError:
continue
languages.append((str(l), l.display_name))
languages.append((str(locale), locale.display_name))
languages.sort(key=lambda x: x[1].lower())
return languages
@ -170,7 +170,7 @@ class _TranslationProxy(object):
def __repr__(self):
try:
return 'i' + repr(unicode(self.value))
except:
except ValueError:
return '<%s broken>' % self.__class__.__name__

View File

@ -26,7 +26,7 @@ from lodgeit.i18n import get_translations
try:
from hashlib import sha1
except:
except ImportError:
from sha import new as sha1
#: Jinja2 Environment for our template handling

View File

@ -1,5 +1,5 @@
Jinja2
Werkzeug
Werkzeug<0.16
Pygments
SQLAlchemy==0.9.7
simplejson

View File

@ -10,6 +10,7 @@ deps = -r{toxinidir}/requirements.txt
commands = nosetests
[testenv:pep8]
basepython = python2
commands = flake8
[flake8]