~ubuntu-branches/ubuntu/precise/python2.7/precise-security

« back to all changes in this revision

Viewing changes to Lib/ConfigParser.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-03-09 23:23:55 UTC
  • mfrom: (36.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20120309232355-syhmsoce7nubjxgl
Tags: 2.7.3~rc1-1ubuntu1
* Merge with Debian; remaining changes:
  - Build-depend on libdb5.1-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
    def __init__(self, section):
143
143
        Error.__init__(self, 'No section: %r' % (section,))
144
144
        self.section = section
 
145
        self.args = (section, )
145
146
 
146
147
class DuplicateSectionError(Error):
147
148
    """Raised when a section is multiply-created."""
149
150
    def __init__(self, section):
150
151
        Error.__init__(self, "Section %r already exists" % section)
151
152
        self.section = section
 
153
        self.args = (section, )
152
154
 
153
155
class NoOptionError(Error):
154
156
    """A requested option was not found."""
158
160
                       (option, section))
159
161
        self.option = option
160
162
        self.section = section
 
163
        self.args = (option, section)
161
164
 
162
165
class InterpolationError(Error):
163
166
    """Base class for interpolation-related exceptions."""
166
169
        Error.__init__(self, msg)
167
170
        self.option = option
168
171
        self.section = section
 
172
        self.args = (option, section, msg)
169
173
 
170
174
class InterpolationMissingOptionError(InterpolationError):
171
175
    """A string substitution required a setting which was not available."""
179
183
               % (section, option, reference, rawval))
180
184
        InterpolationError.__init__(self, option, section, msg)
181
185
        self.reference = reference
 
186
        self.args = (option, section, rawval, reference)
182
187
 
183
188
class InterpolationSyntaxError(InterpolationError):
184
189
    """Raised when the source text into which substitutions are made
194
199
               "\trawval : %s\n"
195
200
               % (section, option, rawval))
196
201
        InterpolationError.__init__(self, option, section, msg)
 
202
        self.args = (option, section, rawval)
197
203
 
198
204
class ParsingError(Error):
199
205
    """Raised when a configuration file does not follow legal syntax."""
202
208
        Error.__init__(self, 'File contains parsing errors: %s' % filename)
203
209
        self.filename = filename
204
210
        self.errors = []
 
211
        self.args = (filename, )
205
212
 
206
213
    def append(self, lineno, line):
207
214
        self.errors.append((lineno, line))
218
225
        self.filename = filename
219
226
        self.lineno = lineno
220
227
        self.line = line
 
228
        self.args = (filename, lineno, line)
221
229
 
222
230
 
223
231
class RawConfigParser:
570
578
    def keys(self):
571
579
        result = []
572
580
        seen = set()
573
 
        for mapping in self_maps:
 
581
        for mapping in self._maps:
574
582
            for key in mapping:
575
583
                if key not in seen:
576
584
                    result.append(key)