comparison twisted/plugins/libervia.py @ 432:8ecc5a7062e4

browser and server sides: fixes module import + use enumerate instead of xrange
author souliane <souliane@mailoo.org>
date Sun, 27 Apr 2014 18:53:37 +0200
parents 39b07289ff42
children bbdbee25123a
comparison
equal deleted inserted replaced
431:4fcf9bac109c 432:8ecc5a7062e4
48 If you do it later: after the command line options have been parsed, there's no good way to know 48 If you do it later: after the command line options have been parsed, there's no good way to know
49 if the options values are the hard-coded ones or if they have been passed on the command line. 49 if the options values are the hard-coded ones or if they have been passed on the command line.
50 """ 50 """
51 config = SafeConfigParser() 51 config = SafeConfigParser()
52 config.read(Const.CONFIG_FILES) 52 config.read(Const.CONFIG_FILES)
53 for index in xrange(0, len(self.optParameters)): 53 for index, param in list(enumerate(self.optParameters)):
54 name = self.optParameters[index][0] 54 # index is only used to not modify the loop variable "param"
55 name = param[0]
55 try: 56 try:
56 value = config.get('libervia', name) 57 value = config.get('libervia', name)
57 self.optParameters[index][2] = self.optParameters[index][4](value) 58 self.optParameters[index][2] = param[4](value)
58 except (NoSectionError, NoOptionError): 59 except (NoSectionError, NoOptionError):
59 pass 60 pass
60 usage.Options.__init__(self) 61 usage.Options.__init__(self)
61 62
62 63