~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Vincent Ladeuil
  • Date: 2009-12-15 15:33:49 UTC
  • mto: (4905.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4906.
  • Revision ID: v.ladeuil+lp@free.fr-20091215153349-lsc6sjk57hvj11fc
Implement config.suppress_warning.

* bzrlib/tests/test_config.py:
(TestSupressWarning): Test suppress_warning for known and unkwnon
warnings.

* bzrlib/config.py:
(Config.suppress_warning): Check whether or not the given warning
is configured.

Show diffs side-by-side

added added

removed removed

Lines of Context:
325
325
                path = 'bzr'
326
326
            return path
327
327
 
 
328
    def suppress_warning(self, warning):
 
329
        """Should the warning be suppressed or emitted.
 
330
 
 
331
        :param warning: The name of the warning being tested.
 
332
 
 
333
        :returns: True if the warning should be suppressed, False otherwise.
 
334
        """
 
335
        warnings = self.get_user_option_as_list('suppress_warnings')
 
336
        if warnings is None or warning not in warnings:
 
337
            return False
 
338
        else:
 
339
            return True
 
340
 
328
341
 
329
342
class IniBasedConfig(Config):
330
343
    """A configuration policy that draws from ini files."""