X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=openerp%2F__init__.py;h=22c8c98256ac610cdb1c2201b0e995dc365dd54d;hb=f564973ce0a88bc2a7bed49c61461f30c2b3de63;hp=1db7b61619997471cb9c3c60356406956b74ddad;hpb=7674db0ed5a128a36d6ec0ae8f59bf3d5b0bbd70;p=odoo%2Fodoo.git diff --git a/openerp/__init__.py b/openerp/__init__.py index 1db7b61..22c8c98 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,19 +15,39 @@ # 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.. """ + +import sys + +# Is the server running with gevent. +evented = False +if sys.modules.get("gevent") is not None: + evented = True + + +# 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 + # The hard-coded super-user id (a.k.a. administrator, or root user). SUPERUSER_ID = 1 import addons import cli import conf +import http import loglevels import modules import netsvc @@ -50,5 +70,12 @@ wsgi.register_wsgi_handler = wsgi.wsgi_server.register_wsgi_handler # locks between threads. multi_process = False +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) + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: