cubicweb/etwist/service.py
changeset 11870 3a84a79c4ed5
parent 11057 0b59724cb3f2
child 11913 4516c3956d46
equal deleted inserted replaced
11869:d8b66e3fd335 11870:3a84a79c4ed5
     1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     1 # copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
     3 #
     3 #
     4 # This file is part of CubicWeb.
     4 # This file is part of CubicWeb.
     5 #
     5 #
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
     6 # CubicWeb is free software: you can redistribute it and/or modify it under the
    36 import logging
    36 import logging
    37 from logging import getLogger, handlers
    37 from logging import getLogger, handlers
    38 from cubicweb import set_log_methods
    38 from cubicweb import set_log_methods
    39 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
    39 from cubicweb.cwconfig import CubicWebConfiguration as cwcfg
    40 
    40 
       
    41 
    41 def _check_env(env):
    42 def _check_env(env):
    42     env_vars = ('CW_INSTANCES_DIR', 'CW_INSTANCES_DATA_DIR', 'CW_RUNTIME_DIR')
    43     env_vars = ('CW_INSTANCES_DIR', 'CW_INSTANCES_DATA_DIR', 'CW_RUNTIME_DIR')
    43     for var in env_vars:
    44     for var in env_vars:
    44         if var not in env:
    45         if var not in env:
    45             raise Exception('The environment variables %s must be set.' % \
    46             raise Exception('The environment variables %s must be set.' %
    46                             ', '.join(env_vars))
    47                             ', '.join(env_vars))
    47     if not env.get('USERNAME'):
    48     if not env.get('USERNAME'):
    48         env['USERNAME'] = 'cubicweb'
    49         env['USERNAME'] = 'cubicweb'
       
    50 
    49 
    51 
    50 class CWService(object, win32serviceutil.ServiceFramework):
    52 class CWService(object, win32serviceutil.ServiceFramework):
    51     _svc_name_ = None
    53     _svc_name_ = None
    52     _svc_display_name_ = None
    54     _svc_display_name_ = None
    53     instance = None
    55     instance = None