Property

A channel can have arbitrary properties assigned to it. Properties are inherited by subchannels; a property set on the root channel applies to every channel, unless a subchannel overrides it.

The name of a property is a hierarchical qualified name: com.eblong.whatever.prop These names are not tied to sound package names. (Maybe they should be?)

The value of a property can be any Python object. (Including None, although that may confuse users.)

Properties can be set on the root channel from the outside. You can use the --prop argument to Boodler (--prop KEY1=VAL1 --prop KEY2=VAL2, etc). You can also set an environment variable (set BOODLER_PROPERTIES to KEY1=VAL1,KEY2=VAL2, etc.)

API

The Channel class will have these methods:

  • get_prop(key, default=None)
  • has_prop(key)
  • set_prop(key, val)
  • del_prop(key)

get_prop() and has_prop() respect inheritance; they will return (or detect) properties set in parent channels. set_prop() sets a value for this channel, possibly overriding an inherited value. del_prop() unsets the value for this channel, if any; if there is an inherited value, del_prop() may uncover it.

The Agent class will offer the same methods, operating on the agent's own channel.

Property - last changed 2007-10-25 17:34 by Andrew Plotkin (zarf)