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

Unified Diff: cms/sources.py

Issue 29886648: Issue #6942 - Add XTM integration in CMS (Closed)
Patch Set: Addressed comments on patch set #2 Created Oct. 3, 2018, 2:50 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
Index: cms/sources.py
diff --git a/cms/sources.py b/cms/sources.py
index f7ebfde68a00225fa8ab6c7f777cb37400873a91..50ac04484922e1d47b3132dad7ee23126ca4371b 100644
--- a/cms/sources.py
+++ b/cms/sources.py
@@ -272,6 +272,16 @@ class FileSource(Source):
do_list(self.get_path(subdir), '')
return result
+ def write_to_config(self, section, option, value):
+ config = self.read_config()
+ try:
+ config.set(section, option, value)
+ except ConfigParser.NoSectionError:
+ config.add_section(section)
+ config.set(section, option, value)
+ with open(self.get_path('settings.ini'), 'w') as cnf:
+ config.write(cnf)
+
def get_cache_dir(self):
return os.path.join(self._dir, 'cache')
@@ -379,6 +389,7 @@ def create_source(path, cached=False):
source = FileSource(path)
config = source.read_config()
+ print(source.read_file('settings.ini')[0])
Vasily Kuznetsov 2018/10/05 10:56:26 Oops.
Tudor Avram 2018/10/05 12:34:40 haha, that was from Thursday night :))
try:
ap = config.get('paths', 'additional-paths').strip()
additional_paths = filter(None, ap.split())

Powered by Google App Engine
This is Rietveld