From 8a137d7e97e8b17d0e388bf28030768556eb38b8 Mon Sep 17 00:00:00 2001 From: James Long Date: Wed, 14 Dec 2011 15:52:13 -0500 Subject: [PATCH] make l10n_check command only output l10n template if blocks exist --- lib/l10n_utils/management/commands/l10n_check.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/l10n_utils/management/commands/l10n_check.py b/lib/l10n_utils/management/commands/l10n_check.py index dcf94babb7..ae11c577c5 100644 --- a/lib/l10n_utils/management/commands/l10n_check.py +++ b/lib/l10n_utils/management/commands/l10n_check.py @@ -169,13 +169,13 @@ def copy_template(tmpl, lang): """Create a new l10n template by copying the l10n blocks""" parser = L10nParser() - blocks = parser.parse_template(app_tmpl(tmpl), only_blocks=True) + blocks = list(parser.parse_template(app_tmpl(tmpl), only_blocks=True)) dest_file = l10n_tmpl(tmpl, lang) - # Make sure the templates directory for this locale and app exists - ensure_dir_exists(os.path.dirname(dest_file)) - if blocks: + # Make sure the templates directory for this locale and app exists + ensure_dir_exists(os.path.dirname(dest_file)) + with codecs.open(dest_file, 'w', 'utf-8') as dest: dest.write('{# Version: %s #}\n\n' % get_todays_version()) dest.write('{%% extends "%s" %%}\n\n' % tmpl)