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 #4 Created Oct. 5, 2018, 4:23 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,
Tudor Avram 2018/10/05 16:28:48 The diffs in this file come from rebasing everythi
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
11 # GNU General Public License for more details. 11 # GNU General Public License for more details.
(...skipping 253 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 'read_config', 410 'read_config',
401 'read_template', 411 'read_template',
402 'read_locale', 412 'read_locale',
403 'read_file', 413 'read_file',
404 'read_include', 414 'read_include',
405 'exec_file', 415 'exec_file',
406 ]: 416 ]:
407 setattr(source, fname, _memoize(getattr(source, fname))) 417 setattr(source, fname, _memoize(getattr(source, fname)))
408 418
409 return source 419 return source
OLDNEW

Powered by Google App Engine
This is Rietveld