Kid Configuration Consolidation

As the work to simplify the Kid code base continues it became obvious to me that there needs to be a unified way to handle configuration options. Currently there are four ways that default options are set:
  1. Environment variables (e.g. KID_OUTPUT_PY)
  2. String literals (e.g. 'utf-8' hard coded in KidParser.__init__)
  3. Global variables in a module (e.g. assume_encoding in kid/
  4. Class attributes (e.g. Serializer.encoding)
Not only are there several ways to do the same thing, but there are subtle bugs lurking. For example, ticket #138 reports an issue caused by the implementation of the class attribute default options. I have already started down the path toward reconciliation by creating the module. The API is light weight and simply consists of get, set and isset functions. The next step is to start refactoring the code to use the new API.
blog comments powered by Disqus