32 |
32 |
33 from cubicweb.cwconfig import CONFIGURATIONS |
33 from cubicweb.cwconfig import CONFIGURATIONS |
34 from cubicweb.web.webconfig import WebConfiguration |
34 from cubicweb.web.webconfig import WebConfiguration |
35 |
35 |
36 |
36 |
37 class TwistedConfiguration(WebConfiguration): |
37 class WebConfigurationBase(WebConfiguration): |
38 """web instance (in a twisted web server) client of a RQL server""" |
38 """web instance (in a twisted web server) client of a RQL server""" |
39 name = 'twisted' |
|
40 |
39 |
41 options = merge_options(( |
40 options = merge_options(( |
42 # ctl configuration |
41 # ctl configuration |
43 ('port', |
42 ('port', |
44 {'type' : 'int', |
43 {'type' : 'int', |
105 def default_base_url(self): |
104 def default_base_url(self): |
106 from socket import getfqdn |
105 from socket import getfqdn |
107 return 'http://%s:%s/' % (self['host'] or getfqdn(), self['port'] or 8080) |
106 return 'http://%s:%s/' % (self['host'] or getfqdn(), self['port'] or 8080) |
108 |
107 |
109 |
108 |
110 CONFIGURATIONS.append(TwistedConfiguration) |
|
111 |
|
112 try: |
109 try: |
113 from cubicweb.server.serverconfig import ServerConfiguration |
110 from cubicweb.server.serverconfig import ServerConfiguration |
114 |
111 |
115 class AllInOneConfiguration(TwistedConfiguration, ServerConfiguration): |
112 class AllInOneConfiguration(WebConfigurationBase, ServerConfiguration): |
116 """repository and web instance in the same twisted process""" |
113 """repository and web instance in the same twisted process""" |
117 name = 'all-in-one' |
114 name = 'all-in-one' |
118 options = merge_options(TwistedConfiguration.options |
115 options = merge_options(WebConfigurationBase.options |
119 + ServerConfiguration.options) |
116 + ServerConfiguration.options) |
120 |
117 |
121 cubicweb_appobject_path = TwistedConfiguration.cubicweb_appobject_path | ServerConfiguration.cubicweb_appobject_path |
118 cubicweb_appobject_path = WebConfigurationBase.cubicweb_appobject_path | ServerConfiguration.cubicweb_appobject_path |
122 cube_appobject_path = TwistedConfiguration.cube_appobject_path | ServerConfiguration.cube_appobject_path |
119 cube_appobject_path = WebConfigurationBase.cube_appobject_path | ServerConfiguration.cube_appobject_path |
123 def pyro_enabled(self): |
120 def pyro_enabled(self): |
124 """tell if pyro is activated for the in memory repository""" |
121 """tell if pyro is activated for the in memory repository""" |
125 return self['pyro-server'] |
122 return self['pyro-server'] |
126 |
123 |
127 |
124 |