backend/common/rhnConfig.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
New commits:
commit 10bbbabc430fafa7ab94312baa31ede559796808
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Tue Jul 27 13:40:20 2010 -0400
577868 - adding proper handling of multiline key/value values
diff --git a/backend/common/rhnConfig.py b/backend/common/rhnConfig.py
index bde166d..193046f 100644
--- a/backend/common/rhnConfig.py
+++ b/backend/common/rhnConfig.py
@@ -599,7 +599,18 @@ def read_file(file):
reads a text config file and returns its lines in a list
"""
try:
- return open(file, 'rb').readlines()
+ lines = open(file, 'rb').readlines()
+ new_lines = []
+ combined = ''
+ for line in lines:
+ #if the line isn't part of a multiline, lets add it
+ if line.find('\\\n') < 0:
+ combined = combined + line
+ new_lines.append(combined)
+ combined = ''
+ else:
+ combined = combined + line.replace('\\\n', ' ')
+ return new_lines
except (IOError, OSError), e:
raise ConfigParserError("Can not read config file", file, e.args[1])
Show replies by date