# HG changeset patch # User Sylvain Thénault # Date 1295432559 -3600 # Node ID 5ae2bc554c23daf1b6444d04953b7af7770df8a1 # Parent b70a26ca271c8ce55cdfced7c9d356dfced23d21 [config] stop using a metaclass for registration of "public" configuration, simply do it explicitly diff -r b70a26ca271c -r 5ae2bc554c23 cwconfig.py --- a/cwconfig.py Wed Jan 19 10:13:31 2011 +0100 +++ b/cwconfig.py Wed Jan 19 11:22:39 2011 +0100 @@ -159,14 +159,6 @@ SMTP_LOCK = Lock() -class metaconfiguration(type): - """metaclass to automaticaly register configuration""" - def __new__(mcs, name, bases, classdict): - cls = super(metaconfiguration, mcs).__new__(mcs, name, bases, classdict) - if classdict.get('name'): - CONFIGURATIONS.append(cls) - return cls - def configuration_cls(name): """return the configuration class registered with the given name""" try: @@ -290,7 +282,6 @@ class CubicWebNoAppConfiguration(ConfigurationMixIn): """base class for cubicweb configuration without a specific instance directory """ - __metaclass__ = metaconfiguration # to set in concrete configuration name = None # log messages format (see logging module documentation for available keys) diff -r b70a26ca271c -r 5ae2bc554c23 etwist/twconfig.py --- a/etwist/twconfig.py Wed Jan 19 10:13:31 2011 +0100 +++ b/etwist/twconfig.py Wed Jan 19 11:22:39 2011 +0100 @@ -23,7 +23,6 @@ * the "all-in-one" configuration to get a web instance running in a twisted web server integrating a repository server in the same process (only available if the repository part of the software is installed - """ __docformat__ = "restructuredtext en" @@ -31,8 +30,10 @@ from logilab.common.configuration import Method +from cubicweb.cwconfig import CONFIGURATIONS from cubicweb.web.webconfig import WebConfiguration, merge_options + class TwistedConfiguration(WebConfiguration): """web instance (in a twisted web server) client of a RQL server""" name = 'twisted' @@ -98,6 +99,9 @@ from socket import gethostname return 'http://%s:%s/' % (self['host'] or gethostname(), self['port'] or 8080) + +CONFIGURATIONS.append(TwistedConfiguration) + try: from cubicweb.server.serverconfig import ServerConfiguration @@ -114,5 +118,8 @@ """tell if pyro is activated for the in memory repository""" return self['pyro-server'] + + CONFIGURATIONS.append(AllInOneConfiguration) + except ImportError: pass diff -r b70a26ca271c -r 5ae2bc554c23 server/serverconfig.py --- a/server/serverconfig.py Wed Jan 19 10:13:31 2011 +0100 +++ b/server/serverconfig.py Wed Jan 19 11:22:39 2011 +0100 @@ -27,7 +27,7 @@ from logilab.common.decorators import wproperty, cached from cubicweb.toolsutils import read_config, restrict_perms_to_user -from cubicweb.cwconfig import CubicWebConfiguration, merge_options +from cubicweb.cwconfig import CONFIGURATIONS, CubicWebConfiguration, merge_options from cubicweb.server import SOURCE_TYPES @@ -346,3 +346,6 @@ return ServerMigrationHelper(self, schema, interactive=interactive, cnx=cnx, repo=repo, connect=connect, verbosity=verbosity) + + +CONFIGURATIONS.append(ServerConfiguration)