|
@ -229,7 +229,7 @@ def create_node_after(predecessor, type, **kwargs): |
|
|
from seminar.models import TreeNode |
|
|
from seminar.models import TreeNode |
|
|
if predecessor is None: |
|
|
if predecessor is None: |
|
|
raise TreeLibError("Nelze vyrábět sirotky! (predecessor=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!") |
|
|
raise TreeLibError("Nový node není node!") |
|
|
new_node = type.objects.create(**kwargs) |
|
|
new_node = type.objects.create(**kwargs) |
|
|
new_node.root = predecessor.root |
|
|
new_node.root = predecessor.root |
|
@ -246,7 +246,7 @@ def create_child(parent, type, **kwargs): |
|
|
from seminar.models import TreeNode |
|
|
from seminar.models import TreeNode |
|
|
if parent is None: |
|
|
if parent is None: |
|
|
raise TreeLibError("Nelze vyrábět sirotky! (parent=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!") |
|
|
raise TreeLibError("Nový node není node!") |
|
|
new_node = type.objects.create(**kwargs) |
|
|
new_node = type.objects.create(**kwargs) |
|
|
new_node.root = parent.root |
|
|
new_node.root = parent.root |
|
@ -284,7 +284,7 @@ def create_node_before(successor, type, **kwargs): |
|
|
from seminar.models import TreeNode |
|
|
from seminar.models import TreeNode |
|
|
if successor is None: |
|
|
if successor is None: |
|
|
raise TreeLibError("Nelze vyrábět sirotky! (successor=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!") |
|
|
raise TreeLibError("Nový node není node!") |
|
|
if safe_pred(successor) is not None: |
|
|
if safe_pred(successor) is not None: |
|
|
# Easy: přidáme za předchůdce |
|
|
# Easy: přidáme za předchůdce |
|
|