2009-10-20 10:52:23 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2006-12-07 13:41:40 +00:00
|
|
|
##############################################################################
|
2013-01-17 15:50:03 +00:00
|
|
|
#
|
2009-10-14 12:32:15 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
2008-06-16 11:00:21 +00:00
|
|
|
#
|
2008-11-03 18:27:16 +00:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2009-10-14 12:32:15 +00:00
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
2008-11-03 18:27:16 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2009-10-14 12:32:15 +00:00
|
|
|
# GNU Affero General Public License for more details.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
2009-10-14 12:32:15 +00:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2013-01-17 15:50:03 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-12-07 13:41:40 +00:00
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2014-02-09 15:18:22 +00:00
|
|
|
""" OpenERP core library."""
|
2013-06-06 11:32:37 +00:00
|
|
|
|
2014-02-09 15:18:22 +00:00
|
|
|
#----------------------------------------------------------
|
|
|
|
# Running mode flags (gevent, prefork)
|
|
|
|
#----------------------------------------------------------
|
2013-06-06 11:32:37 +00:00
|
|
|
# Is the server running with gevent.
|
2014-02-09 15:18:22 +00:00
|
|
|
import sys
|
2013-06-06 11:32:37 +00:00
|
|
|
evented = False
|
2013-09-09 23:19:46 +00:00
|
|
|
if sys.modules.get("gevent") is not None:
|
|
|
|
evented = True
|
2013-06-06 11:32:37 +00:00
|
|
|
|
2014-02-09 15:18:22 +00:00
|
|
|
# Is the server running in pefork mode (e.g. behind Gunicorn).
|
|
|
|
# If this is True, the processes have to communicate some events,
|
|
|
|
# e.g. database update or cache invalidation. Each process has also
|
|
|
|
# its own copy of the data structure and we don't need to care about
|
|
|
|
# locks between threads.
|
|
|
|
multi_process = False
|
|
|
|
|
|
|
|
#----------------------------------------------------------
|
|
|
|
# libc UTC hack
|
|
|
|
#----------------------------------------------------------
|
2013-03-07 12:16:37 +00:00
|
|
|
# Make sure the OpenERP server runs in UTC. This is especially necessary
|
|
|
|
# under Windows as under Linux it seems the real import of time is
|
|
|
|
# sufficiently deferred so that setting the TZ environment variable
|
|
|
|
# in openerp.cli.server was working.
|
|
|
|
import os
|
|
|
|
os.environ['TZ'] = 'UTC' # Set the timezone...
|
|
|
|
import time # ... *then* import time.
|
|
|
|
del os
|
|
|
|
del time
|
|
|
|
|
2014-02-09 15:18:22 +00:00
|
|
|
#----------------------------------------------------------
|
|
|
|
# Shortcuts
|
|
|
|
#----------------------------------------------------------
|
2011-09-26 09:01:56 +00:00
|
|
|
# The hard-coded super-user id (a.k.a. administrator, or root user).
|
|
|
|
SUPERUSER_ID = 1
|
2011-04-20 10:26:27 +00:00
|
|
|
|
2014-02-09 15:18:22 +00:00
|
|
|
def registry(database_name):
|
|
|
|
"""
|
|
|
|
Return the model registry for the given database. If the registry does not
|
|
|
|
exist yet, it is created on the fly.
|
|
|
|
"""
|
|
|
|
return modules.registry.RegistryManager.get(database_name)
|
|
|
|
|
|
|
|
#----------------------------------------------------------
|
|
|
|
# Imports
|
|
|
|
#----------------------------------------------------------
|
2011-02-08 09:29:23 +00:00
|
|
|
import addons
|
2012-11-27 00:55:13 +00:00
|
|
|
import cli
|
2011-04-20 10:26:27 +00:00
|
|
|
import conf
|
2013-02-01 09:37:27 +00:00
|
|
|
import http
|
2011-02-07 12:57:23 +00:00
|
|
|
import loglevels
|
2011-04-20 15:27:18 +00:00
|
|
|
import modules
|
2011-02-07 12:57:23 +00:00
|
|
|
import netsvc
|
|
|
|
import osv
|
2011-02-08 09:29:23 +00:00
|
|
|
import pooler
|
2011-02-07 12:57:23 +00:00
|
|
|
import release
|
2011-02-08 09:29:23 +00:00
|
|
|
import report
|
|
|
|
import service
|
2011-02-07 12:57:23 +00:00
|
|
|
import sql_db
|
2011-02-08 09:29:23 +00:00
|
|
|
import tools
|
2011-02-07 12:57:23 +00:00
|
|
|
import workflow
|
2013-03-27 09:31:25 +00:00
|
|
|
|
2008-07-23 15:01:27 +00:00
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
|
|
|