mozilla/configman — pull request #28 by twobraids (2012-03-21 20:06:00+00:00)
Title: fixed aggregation bug and enhanced class_list converter

The class_list_converter added a couple weeks back needed some enhancements. If the user changed the list at run time, there was no way to know how long the list was without trying to iterate over the the child namespaces that were inserted into the parent namespace. Further, if the namespace naming template were unknown, it would be difficult to even know what child namespaces had the child classes in them.

I resolved this by adding some class level variables to the class_list class. It can be interrogated for the list of namespaces that it used for the child classes.

It is likely that the programmer using the class_list converter is going to want to instantiate the classes in each namespace. Doing so is awkward because in each instantiation, the local namespace would have to passed into the class constructor. As a convenience, the converter has a new parameter called 'instantiate_class', a boolean. If True, configman will instantiate the each class with the proper namespace for the programmer.

In implementing this, I discovered a bug in the code that expands aggregations. A boolean short-circuit expression was allowing only the first aggregation in a parent namespace to be aggregated. The solution was to just reverse the order of the items in the boolean expression, thwarting the short circuit mechanism.

These changes include tests.