169 {'type' : 'int', |
169 {'type' : 'int', |
170 'default': None, |
170 'default': None, |
171 'help': 'Pyro server port. If not set, it will be choosen randomly', |
171 'help': 'Pyro server port. If not set, it will be choosen randomly', |
172 'group': 'pyro-server', 'inputlevel': 2, |
172 'group': 'pyro-server', 'inputlevel': 2, |
173 }), |
173 }), |
174 ('pyro-id', # XXX reuse pyro-application-id |
174 ('pyro-id', # XXX reuse pyro-instance-id |
175 {'type' : 'string', |
175 {'type' : 'string', |
176 'default': None, |
176 'default': None, |
177 'help': 'identifier of the repository in the pyro name server', |
177 'help': 'identifier of the repository in the pyro name server', |
178 'group': 'pyro-server', 'inputlevel': 2, |
178 'group': 'pyro-server', 'inputlevel': 2, |
179 }), |
179 }), |
180 ) + CubicWebConfiguration.options) |
180 ) + CubicWebConfiguration.options) |
181 |
181 |
182 # read the schema from the database |
182 # read the schema from the database |
183 read_application_schema = True |
183 read_instance_schema = True |
184 bootstrap_schema = True |
184 bootstrap_schema = True |
185 |
185 |
186 # check user's state at login time |
186 # check user's state at login time |
187 consider_user_state = True |
187 consider_user_state = True |
188 |
188 |
191 core_hooks = True |
191 core_hooks = True |
192 usergroup_hooks = True |
192 usergroup_hooks = True |
193 schema_hooks = True |
193 schema_hooks = True |
194 notification_hooks = True |
194 notification_hooks = True |
195 security_hooks = True |
195 security_hooks = True |
196 application_hooks = True |
196 instance_hooks = True |
197 |
197 |
198 # should some hooks be deactivated during [pre|post]create script execution |
198 # should some hooks be deactivated during [pre|post]create script execution |
199 free_wheel = False |
199 free_wheel = False |
200 |
200 |
201 # list of enables sources when sources restriction is necessary |
201 # list of enables sources when sources restriction is necessary |
206 self._enabled_sources = sourceuris |
206 self._enabled_sources = sourceuris |
207 clear_cache(self, 'sources') |
207 clear_cache(self, 'sources') |
208 |
208 |
209 @classmethod |
209 @classmethod |
210 def schemas_lib_dir(cls): |
210 def schemas_lib_dir(cls): |
211 """application schema directory""" |
211 """instance schema directory""" |
212 return env_path('CW_SCHEMA_LIB', cls.SCHEMAS_LIB_DIR, 'schemas') |
212 return env_path('CW_SCHEMA_LIB', cls.SCHEMAS_LIB_DIR, 'schemas') |
213 |
213 |
214 @classmethod |
214 @classmethod |
215 def backup_dir(cls): |
215 def backup_dir(cls): |
216 """backup directory where a stored db backups before migration""" |
216 """backup directory where a stored db backups before migration""" |
267 """pyro is always enabled in standalone repository configuration""" |
267 """pyro is always enabled in standalone repository configuration""" |
268 return True |
268 return True |
269 |
269 |
270 def load_hooks(self, vreg): |
270 def load_hooks(self, vreg): |
271 hooks = {} |
271 hooks = {} |
272 for path in reversed([self.apphome] + self.cubes_path()): |
|
273 hooksfile = join(path, 'application_hooks.py') |
|
274 if exists(hooksfile): |
|
275 self.warning('application_hooks.py is deprecated, use dynamic ' |
|
276 'objects to register hooks (%s)', hooksfile) |
|
277 context = {} |
|
278 # Use execfile rather than `load_module_from_name` because |
|
279 # the latter gets fooled by the `sys.modules` cache when |
|
280 # loading different configurations one after the other |
|
281 # (another fix would have been to do : |
|
282 # sys.modules.pop('applications_hooks') |
|
283 # or to modify load_module_from_name so that it provides |
|
284 # a use_cache optional parameter |
|
285 execfile(hooksfile, context, context) |
|
286 for event, hooksdef in context['HOOKS'].items(): |
|
287 for ertype, hookcbs in hooksdef.items(): |
|
288 hooks.setdefault(event, {}).setdefault(ertype, []).extend(hookcbs) |
|
289 try: |
272 try: |
290 apphookdefs = vreg.registry_objects('hooks') |
273 apphookdefs = vreg.registry_objects('hooks') |
291 except RegistryNotFound: |
274 except RegistryNotFound: |
292 return hooks |
275 return hooks |
293 for hookdef in apphookdefs: |
276 for hookdef in apphookdefs: |