source: TI12-security/trunk/ndg_saml/ndg/soap/utils/configfileparsers.py @ 7560

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/ndg_saml/ndg/soap/utils/configfileparsers.py
Revision 7560, 1.1 KB checked in by pjkersha, 9 years ago (diff)

Merged ndg.soap back into ndg_saml package - simpler to keep it together.

Line 
1"""Configuration file parsers specialisations
2
3NERC DataGrid Project
4"""
5__author__ = "Philip Kershaw"
6__date__ = "25/01/2010"
7__copyright__ = "(C) 2010 Science and Technology Facilities Council"
8__license__ = "BSD - see LICENSE file in top-level directory"
9__contact__ = "Philip.Kershaw@stfc.ac.uk"
10__revision__ = '$Id: $'
11import re
12from ConfigParser import SafeConfigParser
13
14class CaseSensitiveConfigParser(SafeConfigParser):
15    '''
16    Subclass the SafeConfigParser - to preserve the original string case of the
17    cfg section names - NB, the RawConfigParser default is to lowercase these
18    by default
19    ''' 
20    def optionxform(self, optionstr):
21        '''@type optionstr: basestring
22        @param optionstr: config file option name
23        @return: option name with case preserved
24        @rtype: basestring
25        '''
26        return optionstr
27   
28class WithGetListConfigParser(CaseSensitiveConfigParser):
29    LIST_STRING_PAT = re.compile(',\s*')
30   
31    def getlist(self, section, option):
32        val = self.get(section, option)
33        return WithGetListConfigParser.LIST_STRING_PAT.split(val)
Note: See TracBrowser for help on using the repository browser.