~metacode/ocb-server/ocb-server-7.0

« back to all changes in this revision

Viewing changes to openerp/tools/config.py

  • Committer: Vo Minh Thu
  • Date: 2011-02-07 12:57:23 UTC
  • mto: This revision was merged to the branch mainline in revision 3351.
  • Revision ID: vmt@openerp.com-20110207125723-ooee7d7ng5elmkso
[IMP] openerp python module.

- Some logging code moved from netsvc.py to loglevels.py
- Changed imports to use the new openerp module
- config and netsvc initialization calls move to openerp-server.py
- Moved openerp-server.py outside the old bin directory
- Some imports in tools moved inside the methods to break mutual-dependencies

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import optparse
24
24
import os
25
25
import sys
26
 
import netsvc
 
26
import openerp
 
27
import openerp.loglevels as loglevels
27
28
import logging
28
 
import release
 
29
import openerp.release as release
29
30
 
30
31
def check_ssl():
31
32
    try:
102
103
        self.config_file = fname
103
104
        self.has_ssl = check_ssl()
104
105
 
105
 
        self._LOGLEVELS = dict([(getattr(netsvc, 'LOG_%s' % x), getattr(logging, x))
 
106
        self._LOGLEVELS = dict([(getattr(loglevels, 'LOG_%s' % x), getattr(logging, x))
106
107
                          for x in ('CRITICAL', 'ERROR', 'WARNING', 'INFO', 'TEST', 'DEBUG', 'DEBUG_RPC', 'DEBUG_SQL', 'DEBUG_RPC_ANSWER','NOTSET')])
107
108
 
108
109
        version = "%s %s" % (release.description, release.version)
316
317
            self.options['log_level'] = self._LOGLEVELS.get(self.options['log_level']) or int(self.options['log_level'])
317
318
 
318
319
        if not self.options['root_path'] or self.options['root_path']=='None':
319
 
            self.options['root_path'] = os.path.abspath(os.path.dirname(sys.argv[0]))
 
320
            self.options['root_path'] = os.path.dirname(openerp.__file__)
320
321
        if not self.options['addons_path'] or self.options['addons_path']=='None':
321
322
            self.options['addons_path'] = os.path.join(self.options['root_path'], 'addons')
322
323
 
496
497
 
497
498
config = configmanager()
498
499
 
499
 
# FIXME:following line should be called explicitly by the server
500
 
# when it starts, to allow doing 'import tools.config' from
501
 
# other python executables without parsing *their* args.
502
 
config.parse_config()
503