~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-13 03:39:24 UTC
  • mfrom: (6059.2.3 list-option)
  • Revision ID: pqm@pqm.ubuntu.com-20110813033924-w5vit9zjr8dmqe99
(vila) Implements list config options. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2317
2317
    return int(unicode_str)
2318
2318
 
2319
2319
 
 
2320
def list_from_store(unicode_str):
 
2321
    # ConfigObj return '' instead of u''. Use 'str' below to catch all cases.
 
2322
    if isinstance(unicode_str, (str, unicode)):
 
2323
        if unicode_str:
 
2324
            # A single value, most probably the user forgot (or didn't care to
 
2325
            # add) the final ','
 
2326
            l = [unicode_str]
 
2327
        else:
 
2328
            # The empty string, convert to empty list
 
2329
            l = []
 
2330
    else:
 
2331
        # We rely on ConfigObj providing us with a list already
 
2332
        l = unicode_str
 
2333
    return l
 
2334
 
 
2335
 
2320
2336
class OptionRegistry(registry.Registry):
2321
2337
    """Register config options by their name.
2322
2338