Package gavo :: Package utils :: Module fancyconfig :: Class ListConfigItem
[frames] | no frames]

Class ListConfigItem

source code

  object --+        
           |        
  ConfigItem --+    
               |    
StringConfigItem --+
                   |
                  ListConfigItem
Known Subclasses:

A ConfigItem containing a list of strings, comma separated.

The values are space-normalized. Trailing whitespace-only items are discarded, so "" is an empty list, "," is a list containing one empty string.

There is currently no way to embed commas in the values. If that should become necessary, I'd probably go for backslash escaping.

>>> ci = ListConfigItem("foo"); ci.value, ci.getAsString()
([], '')
>>> ci.set(ci.getAsString());ci.value
[]
>>> ci.set("3, 2, 1, Z\xc3\xbcndung"); ci.value, ci.getAsString()
([u'3', u'2', u'1', u'Z\xfcndung'], '3, 2, 1, Z\xc3\xbcndung, ')
>>> ci.set(",");ci.value
[u'']
>>> ci.set(ci.getAsString());ci.value
[u'']
Instance Methods

Inherited from ConfigItem: __init__, getAsString, set

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  typedesc = 'list of strings'
  default = ""
hash(x)
Properties

Inherited from object: __class__