Need a way to define arbitrary sections based on a master

Bug #310619 reported by Barry Warsaw
Affects Status Importance Assigned to Milestone
Fix Released
Barry Warsaw

Bug Description

lazr.config has a 'template' feature that at first appears to allow for
defining a category template that can be extended with arbitrary sections in a
config file. For example:

from lazr.config import *

with open('schema.cfg', 'w') as fp:
    print >> fp, """\
qux: 9

baz: 1

schema = ConfigSchema('schema.cfg')

with open('config.cfg', 'w') as fp:
    print >> fp, """\
qux: 10


baz: 2

baz: 3

config = schema.load('config.cfg')

print 'woot.qux:', config.woot.qux

for section in config.getByCategory('thing'):
    print '%s: %s' % (, section.baz)

The fact that Curtis, Gary, and I all initially thought this should work is
interesting. :) It does not however, because category sections are limited to
definition in the schema and cannot be extended in the config (i.e. .push()
does not extend categories).

In discussion with Curtis on irc, we determined that lazr.config should
support something like this, but that .templates is not the right tool for the
job. Curtis had this suggestion:

"I suggest .master. In the cases where we have defined service data, we need
a section to define all permitted keys, like template, but is parsed in the
push() method to update the categories."

.master seems right to me.

Related branches

Barry Warsaw (barry)
Changed in lazr.config:
assignee: nobody → barry
importance: Undecided → High
status: New → In Progress
Barry Warsaw (barry)
Changed in lazr.config:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.