Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
neoppod
Commits
dfe6d4e5
Commit
dfe6d4e5
authored
Jan 02, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disallow creating the same node multiple times.
parent
a57e35d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
neo/lib/node.py
neo/lib/node.py
+30
-2
No files found.
neo/lib/node.py
View file @
dfe6d4e5
...
...
@@ -401,8 +401,36 @@ class NodeManager(object):
def
hasUUID
(
self
,
uuid
):
return
uuid
in
self
.
_uuid_dict
def
_createNode
(
self
,
klass
,
**
kw
):
return
klass
(
self
,
**
kw
)
def
_createNode
(
self
,
klass
,
address
=
None
,
uuid
=
None
,
**
kw
):
by_address
=
self
.
getByAddress
(
address
)
by_uuid
=
self
.
getByUUID
(
uuid
)
if
by_address
is
None
and
by_uuid
is
None
:
node
=
klass
(
self
,
address
=
address
,
uuid
=
uuid
,
**
kw
)
else
:
if
by_uuid
is
None
or
by_address
is
by_uuid
:
node
=
by_address
elif
by_address
is
None
:
node
=
by_uuid
else
:
raise
ValueError
(
'Got different nodes for uuid %r: %r and '
'address %r: %r.'
%
(
dump
(
uuid
),
by_uuid
,
address
,
by_address
))
if
uuid
is
not
None
:
node_uuid
=
node
.
getUUID
()
if
node_uuid
is
None
:
node
.
setUUID
(
uuid
)
elif
node_uuid
!=
uuid
:
raise
ValueError
(
'Expected uuid %r on node %r'
%
(
dump
(
uuid
),
node
))
if
address
is
not
None
:
node_address
=
node
.
getAddress
()
if
node_address
is
None
:
node
.
setAddress
(
address
)
elif
node_address
!=
address
:
raise
ValueError
(
'Expected address %r on node %r'
%
(
address
,
node
))
assert
node
.
__class__
is
klass
,
(
node
.
__class__
,
klass
)
return
node
def
createMaster
(
self
,
**
kw
):
""" Create and register a new master """
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment