[IMP] ir.filters: improve create_or_replace() and make unique constraint case insensitive
[odoo/odoo.git] / bin / pooler.py
index e0a0ff2..7a572e7 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
 #
 #    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 <http://www.gnu.org/licenses/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 
 pool_dic = {}
 
-def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False):
+def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False, pooljobs=True):
     if not status:
         status={}
 
@@ -34,10 +34,10 @@ def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False)
         import osv.osv
         pool = osv.osv.osv_pool()
         pool_dic[db_name] = pool
-        
+
         try:
             addons.load_modules(db, force_demo, status, update_module)
-        except Exception, e:
+        except Exception:
             del pool_dic[db_name]
             raise
 
@@ -50,13 +50,13 @@ def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False)
 
         import report
         report.interface.register_all(db)
-        pool.get('ir.cron')._poolJobs(db.dbname)
+        if pooljobs:
+            pool.get('ir.cron').restart(db.dbname)
     return db, pool
 
 
 def restart_pool(db_name, force_demo=False, status=None, update_module=False):
     if db_name in pool_dic:
-        pool_dic[db_name].get('ir.cron').cancel(db_name)
         del pool_dic[db_name]
     return get_db_and_pool(db_name, force_demo, status, update_module=update_module)