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

Unified Diff: cms/bin/generate_static_pages.py

Issue 6504702795579392: Issue 2530 - Selecting Korean language causes all pages to 404 (Closed)
Patch Set: Created May 15, 2015, 1:44 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/bin/generate_static_pages.py
===================================================================
--- a/cms/bin/generate_static_pages.py
+++ b/cms/bin/generate_static_pages.py
@@ -74,36 +74,39 @@ def generate_pages(repo, output_dir):
config = source.read_config()
defaultlocale = config.get("general", "defaultlocale")
locales = list(source.list_locales())
if defaultlocale not in locales:
locales.append(defaultlocale)
# First pass: compile the list of pages with given translation level
+ def get_locale_file(page):
+ try:
+ return config.get("locale_overrides", page)
+ except ConfigParser.Error:
+ return page
+
pagelist = set()
blacklist = set()
for page, format in source.list_pages():
for locale in locales:
if locale == defaultlocale:
pagelist.add((locale, page))
elif source.has_locale(locale, page):
params = get_page_params(source, locale, page, format)
if params["translation_ratio"] >= MIN_TRANSLATED:
pagelist.add((locale, page))
else:
- blacklist.add((locale, page))
+ blacklist.add((locale, get_locale_file(page)))
# Override existance check to avoid linking to pages we don't generate
orig_has_locale = source.has_locale
def has_locale(locale, page):
- try:
- page = config.get("locale_overrides", page)
- except ConfigParser.Error:
- pass
+ page = get_locale_file(page)
if (locale, page) in blacklist:
return False
return orig_has_locale(locale, page)
source.has_locale = has_locale
source.resolve_link.clear_cache()
# Second pass: actually generate pages this time
for locale, page in pagelist:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld