server/serverconfig.py
changeset 2835 04034421b072
parent 2810 550dae61eb88
child 2968 0e3460341023
equal deleted inserted replaced
2834:7df3494ae657 2835:04034421b072
    80     elif CubicWebConfiguration.mode == 'dev':
    80     elif CubicWebConfiguration.mode == 'dev':
    81         BACKUP_DIR = CubicWebConfiguration.RUNTIME_DIR
    81         BACKUP_DIR = CubicWebConfiguration.RUNTIME_DIR
    82     else:
    82     else:
    83         BACKUP_DIR = '/var/lib/cubicweb/backup/'
    83         BACKUP_DIR = '/var/lib/cubicweb/backup/'
    84 
    84 
    85     cubicweb_appobject_path = CubicWebConfiguration.cubicweb_appobject_path | set(['sobjects'])
    85     cubicweb_appobject_path = CubicWebConfiguration.cubicweb_appobject_path | set(['sobjects', 'hooks'])
    86     cube_appobject_path = CubicWebConfiguration.cube_appobject_path | set(['sobjects', 'hooks'])
    86     cube_appobject_path = CubicWebConfiguration.cube_appobject_path | set(['sobjects', 'hooks'])
    87 
    87 
    88     options = merge_options((
    88     options = merge_options((
    89         # ctl configuration
    89         # ctl configuration
    90         ('host',
    90         ('host',
   183     bootstrap_schema = True
   183     bootstrap_schema = True
   184 
   184 
   185     # check user's state at login time
   185     # check user's state at login time
   186     consider_user_state = True
   186     consider_user_state = True
   187 
   187 
   188     # hooks registration configuration
   188     # hooks activation configuration
   189     # all hooks should be activated during normal execution
   189     # all hooks should be activated during normal execution
   190     core_hooks = True
   190     disabled_hooks_categories = set()
   191     usergroup_hooks = True
       
   192     schema_hooks = True
       
   193     notification_hooks = True
       
   194     security_hooks = True
       
   195     instance_hooks = True
       
   196 
   191 
   197     # should some hooks be deactivated during [pre|post]create script execution
   192     # should some hooks be deactivated during [pre|post]create script execution
   198     free_wheel = False
   193     free_wheel = False
   199 
   194 
   200     # list of enables sources when sources restriction is necessary
   195     # list of enables sources when sources restriction is necessary
   253         restrict_perms_to_user(sourcesfile)
   248         restrict_perms_to_user(sourcesfile)
   254 
   249 
   255     def pyro_enabled(self):
   250     def pyro_enabled(self):
   256         """pyro is always enabled in standalone repository configuration"""
   251         """pyro is always enabled in standalone repository configuration"""
   257         return True
   252         return True
   258 
       
   259     def load_hooks(self, vreg):
       
   260         hooks = {}
       
   261         try:
       
   262             apphookdefs = vreg['hooks'].all_objects()
       
   263         except RegistryNotFound:
       
   264             return hooks
       
   265         for hookdef in apphookdefs:
       
   266             # XXX < 3.5 bw compat
       
   267             hookdef.__dict__['config'] = self
       
   268             for event, ertype in hookdef.register_to(vreg.schema):
       
   269                 if ertype == 'Any':
       
   270                     ertype = ''
       
   271                 cb = hookdef.make_callback(event)
       
   272                 hooks.setdefault(event, {}).setdefault(ertype, []).append(cb)
       
   273         return hooks
       
   274 
   253 
   275     def load_schema(self, expand_cubes=False, **kwargs):
   254     def load_schema(self, expand_cubes=False, **kwargs):
   276         from cubicweb.schema import CubicWebSchemaLoader
   255         from cubicweb.schema import CubicWebSchemaLoader
   277         if expand_cubes:
   256         if expand_cubes:
   278             # in case some new dependencies have been introduced, we have to
   257             # in case some new dependencies have been introduced, we have to