Automated merge with ssh://tycho.b2ck.org///home/hg/trytond

This commit is contained in:
Bertrand Chenal committed 2008-04-17 14:51:56 +02:00
commit f3d9833fc2
2 files changed
+12 -10

No files matched your search

+11 -9
View File
@@ -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)])
+1 -1
View File
@@ -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):