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

Unified Diff: cms/sources.py

Issue 29773617: Issue 5618 - Adds fallback to unlocalized paths for files in static dir (Closed)
Patch Set: Created May 7, 2018, 9:18 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 | tests/expected_output/en/rel_path@dynamic » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/sources.py
===================================================================
--- a/cms/sources.py
+++ b/cms/sources.py
@@ -50,25 +50,28 @@
if not self.has_localizable_file(locale, page):
locale = default_locale
elif self.has_page(page):
if not self.has_locale(locale, page):
locale = default_locale
elif self.has_page(alternative_page):
if not self.has_locale(locale, alternative_page):
locale = default_locale
+ elif self.has_static(page):
+ locale = None
else:
logging.warning('Link to %s cannot be resolved', page)
parts = page.split('/')
if parts[-1] == default_page:
page = '/'.join(parts[:-1])
-
- path = '/%s/%s' % (locale, page)
- return locale, urlparse.urlunparse(parsed[0:2] + (path,) + parsed[3:])
+ if locale:
+ path = '/{}/{}'.format(locale, page)
+ return locale, urlparse.urlunparse(parsed[0:2] + (path,) + parsed[3:])
+ return locale, '/' + page
def read_config(self):
configdata = self.read_file('settings.ini')[0]
config = ConfigParser.SafeConfigParser()
config.readfp(StringIO(configdata))
return config
def exec_file(self, filename):
« no previous file with comments | « no previous file | tests/expected_output/en/rel_path@dynamic » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld