~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/config/__init__.py

  • Committer: Curtis Hovey
  • Date: 2011-12-29 05:40:17 UTC
  • mto: This revision was merged to the branch mainline in revision 14606.
  • Revision ID: curtis.hovey@canonical.com-20111229054017-e6ulob0k70kz3sj2
Renamed CanonicalConfig to LaunchpadConfig because that is what it is doing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
        "Can't find %s in %s" % (instance_name, ", ".join(CONFIG_ROOT_DIRS)))
93
93
 
94
94
 
95
 
class CanonicalConfig:
 
95
class LaunchpadConfig:
96
96
    """
97
97
    Singleton configuration, accessed via the `config` module global.
98
98
 
102
102
    """
103
103
 
104
104
    def __init__(self, instance_name=None, process_name=None):
105
 
        """Create a new instance of CanonicalConfig.
 
105
        """Create a new instance of LaunchpadConfig.
106
106
 
107
107
        :param instance_name: the configuration instance to use. Defaults to
108
108
            the value of the LPCONFIG environment variable.
171
171
    def process_name(self):
172
172
        """Return or set the current process's name to select a conf.
173
173
 
174
 
        CanonicalConfig loads the conf file named for the process. When
 
174
        LaunchpadConfig loads the conf file named for the process. When
175
175
        the conf file does not exist, it loads launchpad-lazr.conf instead.
176
176
        """
177
177
        return self._process_name
180
180
        """Set the name of the process to select a conf file.
181
181
 
182
182
        This method is used to set the process_name if it should be
183
 
        different from the name obtained from sys.argv[0]. CanonicalConfig
 
183
        different from the name obtained from sys.argv[0]. LaunchpadConfig
184
184
        will try to load <process_name>-lazr.conf if it exists. Otherwise,
185
185
        it will load launchpad-lazr.conf.
186
186
        """
246
246
        print >> loader, """
247
247
            <configure xmlns="http://namespaces.zope.org/zope">
248
248
                <!-- This file automatically generated using
249
 
                     lp.services.config.CanonicalConfig.generate_overrides.
 
249
                     lp.services.config.LaunchpadConfig.generate_overrides.
250
250
                     DO NOT EDIT. -->
251
251
                <include files="%s/*.zcml" />
252
252
                </configure>""" % self.config_dir
291
291
        return iter(self._config)
292
292
 
293
293
 
294
 
config = CanonicalConfig()
 
294
config = LaunchpadConfig()
295
295
 
296
296
 
297
297
def url(value):