Improve module installation

This commit is contained in:
Cédric Krier committed 2008-02-19 00:41:09 +01:00
1 parent 600316c5e2
commit 74fbb74db0
2 files changed
+9 -5

No files matched your search

+8 -2
View File
@@ -76,7 +76,7 @@ class Node(Singleton):
def __setattr__(self, name, value):
super(Node, self).__setattr__(name, value)
if name in ('init', 'update'):
if name in ('init', 'update', 'demo'):
CONFIG[name][self.name] = 1
for child in self.childs:
setattr(child, name, value)
@@ -276,12 +276,18 @@ def load_modules(database, force_demo=False, update_module=False, lang=None):
cursor.execute("SELECT name FROM ir_module_module " \
"WHERE state IN ('installed', 'to upgrade', 'to remove')")
module_list = [name for (name,) in cursor.fetchall()]
for module in CONFIG['init'].keys():
if CONFIG['init'][module]:
module_list.append(module)
for module in CONFIG['update'].keys():
if CONFIG['update'][module]:
module_list.append(module)
graph = create_graph(module_list, force)
load_module_graph(cursor, graph, lang)
for kind in ('init', 'update'):
for kind in ('init', 'update', 'demo'):
CONFIG[kind] = {}
if update_module:
+1 -3
View File
@@ -81,7 +81,7 @@ class TrytonServer(object):
self.logger.notify_channel("init", netsvc.LOG_INFO,
"could not connect to database '%s'!" % db_name,)
if cursor and CONFIG['init'] and CONFIG['init']['all']:
if cursor and CONFIG['init']:
cursor.execute("SELECT relname " \
"FROM pg_class " \
"WHERE relkind = 'r' AND relname in (" \
@@ -109,8 +109,6 @@ class TrytonServer(object):
if len(cursor.fetchall()) == 0:
self.logger.notify_channel("init", netsvc.LOG_INFO, "init db")
sql_db.init_db(cursor)
if not CONFIG['without_demo']:
CONFIG["demo"]['all'] = 1
cursor.commit()
register_classes()