Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
6bbc21b9
Commit
6bbc21b9
authored
10 years ago
by
Christophe Simonis
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] graph.py: correct Node() creation.
Fixes #3730
parent
c87b9c65
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openerp/modules/graph.py
+10
-5
10 additions, 5 deletions
openerp/modules/graph.py
with
10 additions
and
5 deletions
openerp/modules/graph.py
+
10
−
5
View file @
6bbc21b9
...
@@ -56,7 +56,8 @@ class Graph(dict):
...
@@ -56,7 +56,8 @@ class Graph(dict):
def
add_node
(
self
,
name
,
info
):
def
add_node
(
self
,
name
,
info
):
max_depth
,
father
=
0
,
None
max_depth
,
father
=
0
,
None
for
n
in
[
Node
(
x
,
self
,
None
)
for
x
in
info
[
'
depends
'
]]:
for
d
in
info
[
'
depends
'
]:
n
=
self
.
get
(
d
)
or
Node
(
d
,
self
,
None
)
# lazy creation, do not use default value for get()
if
n
.
depth
>=
max_depth
:
if
n
.
depth
>=
max_depth
:
father
=
n
father
=
n
max_depth
=
n
.
depth
max_depth
=
n
.
depth
...
@@ -117,7 +118,6 @@ class Graph(dict):
...
@@ -117,7 +118,6 @@ class Graph(dict):
later
.
clear
()
later
.
clear
()
current
.
remove
(
package
)
current
.
remove
(
package
)
node
=
self
.
add_node
(
package
,
info
)
node
=
self
.
add_node
(
package
,
info
)
node
.
data
=
info
for
kind
in
(
'
init
'
,
'
demo
'
,
'
update
'
):
for
kind
in
(
'
init
'
,
'
demo
'
,
'
update
'
):
if
package
in
tools
.
config
[
kind
]
or
'
all
'
in
tools
.
config
[
kind
]
or
kind
in
force
:
if
package
in
tools
.
config
[
kind
]
or
'
all
'
in
tools
.
config
[
kind
]
or
kind
in
force
:
setattr
(
node
,
kind
,
True
)
setattr
(
node
,
kind
,
True
)
...
@@ -148,6 +148,8 @@ class Graph(dict):
...
@@ -148,6 +148,8 @@ class Graph(dict):
yield
module
yield
module
level
+=
1
level
+=
1
def
__str__
(
self
):
return
'
\n
'
.
join
(
str
(
n
)
for
n
in
self
if
n
.
depth
==
0
)
class
Node
(
object
):
class
Node
(
object
):
"""
One module in the modules dependency graph.
"""
One module in the modules dependency graph.
...
@@ -162,18 +164,21 @@ class Node(object):
...
@@ -162,18 +164,21 @@ class Node(object):
inst
=
graph
[
name
]
inst
=
graph
[
name
]
else
:
else
:
inst
=
object
.
__new__
(
cls
)
inst
=
object
.
__new__
(
cls
)
inst
.
name
=
name
inst
.
info
=
info
graph
[
name
]
=
inst
graph
[
name
]
=
inst
return
inst
return
inst
def
__init__
(
self
,
name
,
graph
,
info
):
def
__init__
(
self
,
name
,
graph
,
info
):
self
.
name
=
name
self
.
graph
=
graph
self
.
graph
=
graph
self
.
info
=
info
or
getattr
(
self
,
'
info
'
,
{})
if
not
hasattr
(
self
,
'
children
'
):
if
not
hasattr
(
self
,
'
children
'
):
self
.
children
=
[]
self
.
children
=
[]
if
not
hasattr
(
self
,
'
depth
'
):
if
not
hasattr
(
self
,
'
depth
'
):
self
.
depth
=
0
self
.
depth
=
0
self
.
info
=
info
or
{}
@property
def
data
(
self
):
return
self
.
info
def
add_child
(
self
,
name
,
info
):
def
add_child
(
self
,
name
,
info
):
node
=
Node
(
name
,
self
.
graph
,
info
)
node
=
Node
(
name
,
self
.
graph
,
info
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment