Merge lp:~barry/lazr.config/megamerge into lp:~launchpad-pqm/lazr.config/devel
Proposed by
Barry Warsaw
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merged at revision: | not available | ||||||||||||||||
Proposed branch: | lp:~barry/lazr.config/megamerge | ||||||||||||||||
Merge into: | lp:~launchpad-pqm/lazr.config/devel | ||||||||||||||||
To merge this branch: | bzr merge lp:~barry/lazr.config/megamerge | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Curtis Hovey (community) | code | Approve | |
Review via email: mp+2605@code.launchpad.net |
To post a comment you must log in.
This is a megamerge branch that incorporates bug 309859, bug 309988, bug 310619, and bug 310782, as well as a few additional refinements for the .master section. This is the branch I'm currently using in Mailman 3.
=== modified file 'src/lazr/ config/ README. txt' config/ README. txt 2008-12-15 22:22:12 +0000 config/ README. txt 2009-01-04 20:06:34 +0000 ..lazr/ config/ testdata/ base.conf'
--- src/lazr/
+++ src/lazr/
@@ -79,6 +79,21 @@
>>> schema.filename
'.
+If you provide an optional file-like object as a second argument to the '/does/ not/exist. conf', file_object) IConfigSchema, other_schema) filename exist.conf
+constructor, that is used instead of opening the named file implicitly.
+
+ >>> file_object = open(base_conf)
+ >>> other_schema = ConfigSchema(
+ >>> verifyObject(
+ True
+
+ >>> print other_schema.name
+ exist.conf
+ >>> print other_schema.
+ /does/not/
+
+ >>> file_object.close()
+
A schema is made up of multiple SchemaSections. They can be iterated
over in a loop as needed.
@@ -92,6 +107,15 @@ 3.app_b
section_
section_33
+ >>> for section_schema in sorted( other_schema, key=attrgetter( 'name') ):
+ ... print section_schema.name
+ section-2.app-b
+ section-5
+ section_1
+ section_3.app_a
+ section_3.app_b
+ section_33
+
You can check if the schema contains a section name, and that can be
used to access the SchemaSection as a subscript.
@@ -139,6 +163,13 @@ Error: ...
...
NoCategory
+You can pass a default argument to getByCategory() to avoid the exception. getByCategory( 'non-section' , missing) is missing
+
+ >>> missing = object()
+ >>> schema.
+ True
+
+
=============
SchemaSection
=============
@@ -368,6 +399,27 @@
# Accept the default values for the optional section-5.
[section-5]
+The .master section allows admins to define configurations for an arbitrary testfiles_ dir, 'master.conf') testfiles_ dir, 'master- local.conf' ) master_ schema_ conf) schema. getByCategory( 'thing' ) schema. load(master_ local_conf) conf.getByCateg ory('thing' ) conf.thing. one.name Error: ...
+number of processes. If the schema defines .master sections, then the conf
+file can contain sections that extend the .master section. These are like
+categories with templates except that the section names extending .master need
+not be named in the schema file.
+
+ >>> master_schema_conf = path.join(
+ >>> master_local_conf = path.join(
+ >>> master_schema = ConfigSchema(
+ >>> sections = master_
+ >>> sorted(section.name for section in sections)
+ ['thing.master']
+ >>> master_conf = master_
+ >>> sections = master_
+ >>> sorted(section.name for section in sections)
+ ['thing.one', 'thing.two']
+ >>> sorted(section.foo for section in sections)
+ ['1', '2']
+ >>> print master_
+ thing.one
+
The shared.conf file derives the keys and default values from the
schema. This config was loaded before local.conf because its sections
and values are required to be in place before local.conf applies its
@@ -481,6 +533,13 @@
...
NoCategory
+As with schemas, you can pass a default argument to getByCategory() to avoid
+the...