From 4394d321cfc0de44fe07a45727e2907fcf01608a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 17 Apr 2008 09:54:17 +0200 Subject: [PATCH 1/2] Fix print workflow for new direct print functionality --- trytond/workflow/workflow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/workflow/workflow.py b/trytond/workflow/workflow.py index 0213d59d06..b81f412b7d 100644 --- a/trytond/workflow/workflow.py +++ b/trytond/workflow/workflow.py @@ -220,7 +220,7 @@ class InstanceGraph(Report): inpt.close() data = outpt.read() outpt.close() - return ('pdf', base64.encodestring(data)) + return ('pdf', base64.encodestring(data), False) def graph_instance_get(self, cursor, user, graph, instance_id, nested=False, context=None): From 9e182ca8855d2a70434760dbccf7e601872dd1b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 17 Apr 2008 10:43:57 +0200 Subject: [PATCH 2/2] Fix module graph to have all childs dependencies --- trytond/module.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/trytond/module.py b/trytond/module.py index a20f68198e..e981a02132 100644 --- a/trytond/module.py +++ b/trytond/module.py @@ -14,14 +14,9 @@ sys.path.insert(1, MODULES_PATH) class Graph(dict): def add_node(self, name, deps): - max_depth, father = 0, None for i in [Node(x, self) for x in deps]: - if i.depth >= max_depth: - father = i - max_depth = i.depth - if father: - father.add_child(name) - else: + i.add_child(name) + if not deps: Node(name, self) def __iter__(self): @@ -69,14 +64,21 @@ class Node(Singleton): def add_child(self, name): node = Node(name, self.graph) - node.depth = self.depth + 1 - if node not in self.childs: + node.depth = max(self.depth + 1, node.depth) + if node not in self.all_childs(): self.childs.append(node) for attr in ('init', 'update'): if hasattr(self, attr): setattr(node, attr, True) self.childs.sort(lambda x, y: cmp(x.name, y.name)) + def all_childs(self): + res = [] + for child in self.childs: + res.append(child) + res += child.all_childs() + return res + def has_child(self, name): return Node(name, self.graph) in self.childs or \ bool([c for c in self.childs if c.has_child(name)])