Skip to content

Commit

Permalink
Merge pull request #38 from stasm/locale_oserror
Browse files Browse the repository at this point in the history
Catch OSError if locale/ directory doesn't exist
  • Loading branch information
fwenzel committed Jun 6, 2011
2 parents 197eafc + df245cd commit 580b3d9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@
# the `locale` directory. A localizer can add their locale in the l10n
# repository (copy of which is checked out into `locale`) in order to start
# testing the localization on the dev server.
DEV_LANGUAGES = [loc.replace('_', '-') for loc in os.listdir(path('locale'))
if os.path.isdir(path('locale', loc)) and
loc != 'templates']
try:
DEV_LANGUAGES = [
loc.replace('_', '-') for loc in os.listdir(path('locale'))
if os.path.isdir(path('locale', loc)) and loc != 'templates'
]
except OSError:
DEV_LANGUAGES = ('en-US',)

# On stage/prod, the list of accepted locales is manually maintained. Only
# locales whose localizers have signed off on their work should be listed here.
Expand Down

0 comments on commit 580b3d9

Please sign in to comment.