Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: cms/utils.py

Issue 5242593268989952: Issue 2340 - Don`t generate pages if less than 30% have been translated (Closed)
Patch Set: Addressed comments Created May 6, 2015, 5:20 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cms/sources.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/utils.py
===================================================================
--- a/cms/utils.py
+++ b/cms/utils.py
@@ -54,25 +54,31 @@ def get_page_params(source, locale, page
# Note: The converter might change some parameters so we can only read in
# template data here.
params["templatedata"] = source.read_template(params["template"])
defaultlocale = params["config"].get("general", "defaultlocale")
params["defaultlocale"] = defaultlocale
locales = [
- locale
- for locale in source.list_locales()
+ l
+ for l in source.list_locales()
if source.has_locale(locale, localefile)
]
if defaultlocale not in locales:
locales.append(defaultlocale)
locales.sort()
params["available_locales"] = locales
params["head"], params["body"] = converter()
+ if converter.total_translations > 0:
+ params["translation_ratio"] = (1 -
+ float(converter.missing_translations) / converter.total_translations)
+ else:
+ params["translation_ratio"] = 1
+
return params
-def process_page(source, locale, page, format, site_url_override=None):
+def process_page(source, locale, page, format=None, site_url_override=None):
return TemplateConverter(
get_page_params(source, locale, page, format, site_url_override),
key="templatedata"
)()
« no previous file with comments | « cms/sources.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld