cubicweb/etwist/twconfig.py
changeset 11989 309cf6a2c24f
parent 11767 432f87a63057
child 12376 890853079ce3
equal deleted inserted replaced
11988:ffde65347797 11989:309cf6a2c24f
    26 from os.path import join
    26 from os.path import join
    27 
    27 
    28 from logilab.common.configuration import Method, merge_options
    28 from logilab.common.configuration import Method, merge_options
    29 
    29 
    30 from cubicweb.cwconfig import CONFIGURATIONS
    30 from cubicweb.cwconfig import CONFIGURATIONS
       
    31 from cubicweb.server.serverconfig import ServerConfiguration
    31 from cubicweb.web.webconfig import WebConfiguration
    32 from cubicweb.web.webconfig import WebConfiguration
    32 
    33 
    33 
    34 
    34 class WebConfigurationBase(WebConfiguration):
    35 class WebConfigurationBase(WebConfiguration):
    35     """web instance (in a twisted web server) client of a RQL server"""
    36     """web instance (in a twisted web server) client of a RQL server"""
    94     def default_base_url(self):
    95     def default_base_url(self):
    95         from socket import getfqdn
    96         from socket import getfqdn
    96         return 'http://%s:%s/' % (self['host'] or getfqdn().lower(), self['port'] or 8080)
    97         return 'http://%s:%s/' % (self['host'] or getfqdn().lower(), self['port'] or 8080)
    97 
    98 
    98 
    99 
    99 try:
   100 class AllInOneConfiguration(WebConfigurationBase, ServerConfiguration):
   100     from cubicweb.server.serverconfig import ServerConfiguration
   101     """repository and web instance in the same twisted process"""
       
   102     name = 'all-in-one'
       
   103     options = merge_options(WebConfigurationBase.options
       
   104                             + ServerConfiguration.options)
   101 
   105 
   102     class AllInOneConfiguration(WebConfigurationBase, ServerConfiguration):
   106     cubicweb_appobject_path = WebConfigurationBase.cubicweb_appobject_path | ServerConfiguration.cubicweb_appobject_path
   103         """repository and web instance in the same twisted process"""
   107     cube_appobject_path = WebConfigurationBase.cube_appobject_path | ServerConfiguration.cube_appobject_path
   104         name = 'all-in-one'
       
   105         options = merge_options(WebConfigurationBase.options
       
   106                                 + ServerConfiguration.options)
       
   107 
       
   108         cubicweb_appobject_path = WebConfigurationBase.cubicweb_appobject_path | ServerConfiguration.cubicweb_appobject_path
       
   109         cube_appobject_path = WebConfigurationBase.cube_appobject_path | ServerConfiguration.cube_appobject_path
       
   110 
   108 
   111 
   109 
   112     CONFIGURATIONS.append(AllInOneConfiguration)
   110 CONFIGURATIONS.append(AllInOneConfiguration)
   113 
       
   114 except ImportError:
       
   115     pass