TreeLib: Fix type check
This commit is contained in:
parent
b6f2b94a01
commit
15449ae24b
1 changed files with 3 additions and 3 deletions
|
@ -229,7 +229,7 @@ def create_node_after(predecessor, type, **kwargs):
|
|||
from seminar.models import TreeNode
|
||||
if predecessor is None:
|
||||
raise TreeLibError("Nelze vyrábět sirotky! (predecessor=None)")
|
||||
if not isinstance(type, TreeNode):
|
||||
if not issubclass(type, TreeNode):
|
||||
raise TreeLibError("Nový node není node!")
|
||||
new_node = type.objects.create(**kwargs)
|
||||
new_node.root = predecessor.root
|
||||
|
@ -246,7 +246,7 @@ def create_child(parent, type, **kwargs):
|
|||
from seminar.models import TreeNode
|
||||
if parent is None:
|
||||
raise TreeLibError("Nelze vyrábět sirotky! (parent=None)")
|
||||
if not isinstance(type, TreeNode):
|
||||
if not issubclass(type, TreeNode):
|
||||
raise TreeLibError("Nový node není node!")
|
||||
new_node = type.objects.create(**kwargs)
|
||||
new_node.root = parent.root
|
||||
|
@ -284,7 +284,7 @@ def create_node_before(successor, type, **kwargs):
|
|||
from seminar.models import TreeNode
|
||||
if successor is None:
|
||||
raise TreeLibError("Nelze vyrábět sirotky! (successor=None)")
|
||||
if not isinstance(type, TreeNode):
|
||||
if not issubclass(type, TreeNode):
|
||||
raise TreeLibError("Nový node není node!")
|
||||
if safe_pred(successor) is not None:
|
||||
# Easy: přidáme za předchůdce
|
||||
|
|
Loading…
Reference in a new issue