Patch suggested (and partially provided) by Lars Damerow: instead of · python/cpython@9e480ad (original) (raw)

`@@ -199,7 +199,7 @@ def get(self, section, option, raw=0, vars=None):

`

199

199

`# Update with the entry specific variables

`

200

200

`if vars:

`

201

201

`d.update(vars)

`

202

``

`-

option = string.lower(option)

`

``

202

`+

option = self.optionxform(option)

`

203

203

`try:

`

204

204

`rawval = d[option]

`

205

205

`except KeyError:

`

`@@ -236,16 +236,19 @@ def getboolean(self, section, option):

`

236

236

`raise ValueError, 'Not a boolean: %s' % v

`

237

237

`return val

`

238

238

``

``

239

`+

def optionxform(self, optionstr):

`

``

240

`+

return string.lower(optionstr)

`

``

241

+

239

242

`#

`

240

243

`# Regular expressions for parsing section headers and options. Note a

`

241

244

`# slight semantic change from the previous version, because of the use

`

242

245

`# of \w, _ is allowed in section header names.

`

243

``

`-

__SECTCRE = re.compile(

`

``

246

`+

SECTCRE = re.compile(

`

244

247

`r'[' # [

`

245

248

`` r'(?P

[-\w]+)' # -', _' or any alphanum

``

246

249

`r']' # ]

`

247

250

` )

`

248

``

`-

__OPTCRE = re.compile(

`

``

251

`+

OPTCRE = re.compile(

`

249

252

`r'(?P

`

250

253

`r'[ \t][:=][ \t]' # any number of space/tab,

`

251

254

`# followed by separator

`

`@@ -287,7 +290,7 @@ def __read(self, fp):

`

287

290

`# a section header or option header?

`

288

291

`else:

`

289

292

`# is it a section header?

`

290

``

`-

mo = self.__SECTCRE.match(line)

`

``

293

`+

mo = self.SECTCRE.match(line)

`

291

294

`if mo:

`

292

295

`sectname = mo.group('header')

`

293

296

`if self.__sections.has_key(sectname):

`

`@@ -304,7 +307,7 @@ def __read(self, fp):

`

304

307

`` raise MissingSectionHeaderError(fp.name, lineno, line)

``

305

308

`# an option line?

`

306

309

`else:

`

307

``

`-

mo = self.__OPTCRE.match(line)

`

``

310

`+

mo = self.OPTCRE.match(line)

`

308

311

`if mo:

`

309

312

`optname, optval = mo.group('option', 'value')

`

310

313

`optname = string.lower(optname)

`