~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Vincent Ladeuil
  • Date: 2011-05-15 16:07:11 UTC
  • mto: (5743.13.4 config-editor-option)
  • mto: This revision was merged to the branch mainline in revision 5944.
  • Revision ID: v.ladeuil+lp@free.fr-20110515160711-l0og3ady9wuahz1k
Stack.get() provides the registered option default value.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2520
2520
        existence) require loading the store (even partially).
2521
2521
        """
2522
2522
        # FIXME: No caching of options nor sections yet -- vila 20110503
2523
 
 
 
2523
        value = None
2524
2524
        # Ensuring lazy loading is achieved by delaying section matching (which
2525
2525
        # implies querying the persistent storage) until it can't be avoided
2526
2526
        # anymore by using callables to describe (possibly empty) section
2534
2534
            for section in sections:
2535
2535
                value = section.get(name)
2536
2536
                if value is not None:
2537
 
                    return value
2538
 
        # No definition was found
2539
 
        return None
 
2537
                    break
 
2538
            if value is not None:
 
2539
                break
 
2540
        if value is None:
 
2541
            # If the option is registered, it may provide a default value
 
2542
            opt = option_registry.get(name)
 
2543
            value = opt.get_default()
 
2544
        return value
2540
2545
 
2541
2546
    def _get_mutable_section(self):
2542
2547
        """Get the MutableSection for the Stack.