summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
Diffstat (limited to 'cesar')
-rw-r--r--cesar/maximus/python/maximus/station/sta.py30
1 files changed, 21 insertions, 9 deletions
diff --git a/cesar/maximus/python/maximus/station/sta.py b/cesar/maximus/python/maximus/station/sta.py
index 642fffa201..08860a3830 100644
--- a/cesar/maximus/python/maximus/station/sta.py
+++ b/cesar/maximus/python/maximus/station/sta.py
@@ -974,9 +974,11 @@ class STA:
# "<name>:<value>"
# Patterns are separated with spaces.
f = open (self.get_internal_conf(), 'r')
- # 'n' will indicate the line number of a wrongly-formatted line of internal.conf file
+ # 'n' will indicate the line number of a wrongly-formatted line of
+ # internal.conf file
n = 0
- # If needed, data are split into several MME-s, that will be sent at the end of the processing
+ # If needed, data are split into several MME-s, that will be sent
+ # at the end of the processing
mmentries = []
# Initialize Config field of the current MME
Config = ''
@@ -987,21 +989,31 @@ class STA:
# Ignore empty lines and comments
if line != '\n' and line[0] != '#':
l = line.split('=')
- # Check that the format of the current line is SOMETHING = SOMETHING
- if len(l) != 2 or len (l[0].split()) != 1 or len (l[1].split()) != 1:
- print "\n\n!!! ERROR: Line " + str(n) + " of file " + self.get_internal_conf() + " wrongly formatted",
- print "(it must be ITEM = VALUE). DRV_STA_SET_CONFIG.REQ is not sent.\n"
+ # Check that the format of the current line is
+ # SOMETHING = SOMETHING
+ if len(l) != 2 \
+ or len (l[0].split()) != 1 \
+ or len (l[1].split()) != 1:
+ print ("\n\n!!! ERROR: Line %d of file %s wrongly"
+ " formatted it must be ITEM = VALUE)."
+ "DRV_STA_SET_CONFIG.REQ is not sent.\n"
+ ) % (n, self.get_internal_conf ())
return
# Remove white spaces, tabulations, end of line
for i in range (0,len(l)):
l[i] = l[i].strip(' \t\n')
- # Build current line to add to MMEntry and check its length
+ # Build current line to add to MMEntry and check its
+ # length
current_line = l[0] + ':' + l[1] + ' '
if len (current_line) > MAX_SIZE_OF_MMENTRY:
# Current line is too long, ignore it
- print "\n\n!!! ERROR: Line " + str(n) + " of file " + self.get_internal_conf() + " is too long: " + str(len(current_line)),
- print "(length must be lower than " + str(MAX_SIZE_OF_MMENTRY) + "). DRV_STA_SET_CONFIG.REQ is not sent.\n"
+ print ("\n\n!!! ERROR: Line %d of file %s is too long:"
+ " %d (length must be lower than %d."
+ "DRV_STA_SET_CONFIG.REQ is not sent.\n"
+ ) % (n, self.get_internal_conf(),
+ len(current_line),
+ MAX_SIZE_OF_MMENTRY)
return
# Check if there is enough space for the current line in current MME