X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=openerp%2F__init__.py;h=24a193bf759065b28f44077ab9b3bc7625db983f;hb=244c8ee6259fdb699b992996d8ef9ff82b3294b1;hp=a3cd4b3c00ab7f0c323b9c82d0fb4a34e646aa29;hpb=16ac84af68d91b177394a2249f8b866e45ce3de3;p=odoo%2Fodoo.git diff --git a/openerp/__init__.py b/openerp/__init__.py index a3cd4b3..24a193b 100644 --- a/openerp/__init__.py +++ b/openerp/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). # @@ -15,33 +15,83 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## -""" OpenERP core library. +""" OpenERP core library.""" + +#---------------------------------------------------------- +# Running mode flags (gevent, prefork) +#---------------------------------------------------------- +# Is the server running with gevent. +import sys +evented = False +if sys.modules.get("gevent") is not None: + evented = True + +# 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 +#---------------------------------------------------------- +# 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 -""" +#---------------------------------------------------------- +# Shortcuts +#---------------------------------------------------------- +# The hard-coded super-user id (a.k.a. administrator, or root user). +SUPERUSER_ID = 1 +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 +#---------------------------------------------------------- import addons import conf -import ir import loglevels import modules import netsvc import osv import pooler -import pychart import release import report -import run_tests import service import sql_db -import test -import tiny_socket import tools -import wizard import workflow -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +#---------------------------------------------------------- +# Model classes, fields, api decorators, and translations +#---------------------------------------------------------- +from . import models +from . import fields +from . import api +from openerp.tools.translate import _ +#---------------------------------------------------------- +# Other imports, which may require stuff from above +#---------------------------------------------------------- +import cli +import http + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: