From 78325441365f366216132ce54a4ad975093ba2be Mon Sep 17 00:00:00 2001 From: Bruno Bord Date: Fri, 16 Sep 2016 18:44:47 +0200 Subject: [PATCH] refs #42 -- English will always be at the first place in the language list --- CHANGELOG.md | 1 + toolbox/__init__.py | 3 +++ toolbox/tests/test_directories.py | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86b9275..8388d6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Fix the Italian "Cockatrice" translation (#40). * Portuguese (Brazilian) translation of *The Black Hack* and *Additional Things* by Fernando Guedes (#41). +* Making sure that "English" will always be at the first place in the list (#42). ## 2.2.0 (2016-09-02) diff --git a/toolbox/__init__.py b/toolbox/__init__.py index 41ee528..f20dc78 100644 --- a/toolbox/__init__.py +++ b/toolbox/__init__.py @@ -24,6 +24,8 @@ class Builder(object): exceptions = ( 'build', 'static', 'templates', 'tests', + # Warning: ignoring it to add it on the top position in the list + 'english', ) def __init__(self): @@ -48,6 +50,7 @@ def dir_list(self): dir_list = [d for d in os.listdir('.') if d not in self.exceptions] dir_list = filter(lambda x: os.path.isdir(x), dir_list) dir_list = filter(lambda x: not x.startswith('.'), dir_list) + dir_list = ('english',) + tuple(dir_list) return dir_list def get_template(self, path): diff --git a/toolbox/tests/test_directories.py b/toolbox/tests/test_directories.py index 334f384..74c0e97 100644 --- a/toolbox/tests/test_directories.py +++ b/toolbox/tests/test_directories.py @@ -11,3 +11,8 @@ def setUp(self): def test_dir_list_exceptions(self): for directory in self.builder.dir_list: self.assertFalse(directory.startswith('.'), directory) + + def test_dir_list_english(self): + dir_list = tuple(self.builder.dir_list) + self.assertIn('english', dir_list) + self.assertEqual('english', dir_list[0])