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

Unified Diff: cms/sources.py

Issue 29891645: Issue 5601 - Speed up static generation (Closed)
Patch Set: Created Sept. 25, 2018, 12:27 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/converters.py ('k') | tests/test_multi_source.py » ('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
@@ -119,34 +119,34 @@
default_locale = self.read_config().get('general', 'defaultlocale')
return filter(lambda f: os.path.splitext(f)[1].lower() != '.json',
self.list_files('locales/%s' % default_locale))
def has_localizable_file(self, locale, filename):
return self.has_file(self.localizable_file_filename(locale, filename))
def read_localizable_file(self, locale, filename):
- return self.read_file(self.localizable_file_filename(locale, filename), binary=True)[0]
+ return self.read_file(self.localizable_file_filename(locale, filename), True)[0]
Vasily Kuznetsov 2018/09/25 12:31:33 Our memoize function can't deal with keyword param
#
# Static file helpers
#
@staticmethod
def static_filename(filename):
return 'static/%s' % filename
def list_static(self):
return self.list_files('static')
def has_static(self, filename):
return self.has_file(self.static_filename(filename))
def read_static(self, filename):
- return self.read_file(self.static_filename(filename), binary=True)[0]
+ return self.read_file(self.static_filename(filename), True)[0]
#
# Locale helpers
#
def locale_filename(self, locale, page):
config = self.read_config()
try:
@@ -389,18 +389,21 @@
additional_sources = [
create_source(os.path.join(path, p))
for p in additional_paths
]
source = MultiSource([source] + additional_sources)
if cached:
for fname in [
+ 'list_files',
+ 'list_locales',
'resolve_link',
'read_config',
'read_template',
'read_locale',
+ 'read_file',
'read_include',
'exec_file',
]:
setattr(source, fname, _memoize(getattr(source, fname)))
return source
« no previous file with comments | « cms/converters.py ('k') | tests/test_multi_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld