~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Martin Pool
  • Date: 2008-04-24 07:22:53 UTC
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080424072253-opmjij7xfy38w27f
Remove every assert statement from bzrlib!

Depending on the context they are:

 * turned into an explicit if/raise of either AssertionError 
   or something more specific -- particularly where they protect
   programming interfaces, complex invariants, or data file integrity
 * removed, if they're redundant with a later check, not protecting
   a meaningful invariant
 * turned into a selftest method on tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
570
570
 
571
571
    def set_user_option(self, option, value, store=STORE_LOCATION):
572
572
        """Save option and its value in the configuration."""
573
 
        assert store in [STORE_LOCATION,
 
573
        if store not in [STORE_LOCATION,
574
574
                         STORE_LOCATION_NORECURSE,
575
 
                         STORE_LOCATION_APPENDPATH], 'bad storage policy'
 
575
                         STORE_LOCATION_APPENDPATH]:
 
576
            raise ValueError('bad storage policy %r for %r' %
 
577
                (store, option))
576
578
        # FIXME: RBC 20051029 This should refresh the parser and also take a
577
579
        # file lock on locations.conf.
578
580
        conf_dir = os.path.dirname(self._get_filename())