haroldyong / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

Config Parser for getting the boolean value throws error on mod wsgi #302

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Trying to read a boolean value from a ini file using ConfigParser throws error

Here is the code which is called from the modwsgi app
boolValue = ini.getboolean("abc","USER")

Trying to call the getboolean method of ConfiParser throws the error:
File "/var/www/Test/ABC.py" in init
  80.     loadIni()
File "/var/www/Test/ABC.py" in loadIni
  120.         options.user = ini.getboolean("abc","USER")
File "/usr/local/lib/python2.7/ConfigParser.py" in getboolean
  368.         v = self.get(section, option)
File "/usr/local/lib/python2.7/ConfigParser.py" in get
  623.             return self._interpolate(section, option, value, d)
File "/usr/local/lib/python2.7/ConfigParser.py" in _interpolate
  663.             if value and "%(" in value:

Using the below code as the workaround
def getboolean(ini,ss,section="abc"):
    boolValue = ini.get(section,ss,raw=True)
    boolValue = boolValue in ['1','True','true','on']
    return boolValue

This is reproducible on python 2.7 as well as on 2.4

Original issue reported on code.google.com by sandyrid...@gmail.com on 23 Jun 2013 at 10:16

GoogleCodeExporter commented 8 years ago
Please use the mailing list in preference to raising a ticket in the issue 
tracker unless you are somewhat certain that the problem is a bug in mod_wsgi 
and not just some environment issue related to your application, any third 
party packages being used or the operating system. It is much easier to have a 
discussion on the mailing list than the issue tracker.

http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Asking_Your_Questions

You also don't even show what the exception was nor what the contents of the 
ini configuration file were that you believe caused the problem. As stated in 
that reference page though, use the mailing list.

Original comment by Graham.Dumpleton@gmail.com on 23 Jun 2013 at 10:41

GoogleCodeExporter commented 8 years ago
Closing as never seemed to be related to mod_wsgi anyway.

Original comment by Graham.Dumpleton@gmail.com on 16 Sep 2014 at 6:53