Need a way to define arbitrary sections based on a master
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lazr.config |
Fix Released
|
High
|
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, """\
[woot]
qux: 9
[thing.template]
baz: 1
"""
schema = ConfigSchema(
with open('config.cfg', 'w') as fp:
print >> fp, """\
[woot]
qux: 10
[thing.one]
[thing.two]
baz: 2
[thing.three]
baz: 3
"""
config = schema.
print 'woot.qux:', config.woot.qux
for section in config.
print '%s: %s' % (section.name, 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
- Curtis Hovey (community): Needs Fixing (code)
- Curtis Hovey (community): Approve (code)
Changed in lazr.config: | |
assignee: | nobody → barry |
importance: | Undecided → High |
status: | New → In Progress |
Changed in lazr.config: | |
status: | In Progress → Fix Released |