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

Side by Side Diff: cms/sources.py

Issue 29886648: Issue #6942 - Add XTM integration in CMS (Closed)
Patch Set: Addressed comments from patch set #3 Created Oct. 5, 2018, 12:30 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 for filename in files: 266 for filename in files:
267 path = os.path.join(dir, filename) 267 path = os.path.join(dir, filename)
268 if os.path.isfile(path): 268 if os.path.isfile(path):
269 result.append(relpath + filename) 269 result.append(relpath + filename)
270 elif os.path.isdir(path): 270 elif os.path.isdir(path):
271 do_list(path, relpath + filename + '/') 271 do_list(path, relpath + filename + '/')
272 do_list(self.get_path(subdir), '') 272 do_list(self.get_path(subdir), '')
273 return result 273 return result
274 274
275 def write_to_config(self, section, option, value):
276 config = self.read_config()
277 try:
278 config.set(section, option, value)
279 except ConfigParser.NoSectionError:
280 config.add_section(section)
281 config.set(section, option, value)
282 with open(self.get_path('settings.ini'), 'w') as cnf:
283 config.write(cnf)
284
275 def get_cache_dir(self): 285 def get_cache_dir(self):
276 return os.path.join(self._dir, 'cache') 286 return os.path.join(self._dir, 'cache')
277 287
278 288
279 class MultiSource(Source): 289 class MultiSource(Source):
280 """A source that combines the contents of multiple other sources.""" 290 """A source that combines the contents of multiple other sources."""
281 291
282 def __init__(self, base_sources): 292 def __init__(self, base_sources):
283 self._bases = base_sources 293 self._bases = base_sources
284 294
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 'resolve_link', 407 'resolve_link',
398 'read_config', 408 'read_config',
399 'read_template', 409 'read_template',
400 'read_locale', 410 'read_locale',
401 'read_include', 411 'read_include',
402 'exec_file', 412 'exec_file',
403 ]: 413 ]:
404 setattr(source, fname, _memoize(getattr(source, fname))) 414 setattr(source, fname, _memoize(getattr(source, fname)))
405 415
406 return source 416 return source
OLDNEW

Powered by Google App Engine
This is Rietveld