utils.py 415 Bytes
Newer Older
Janez K's avatar
Janez K committed
1 2 3 4 5 6 7 8 9 10 11 12
from workflows.models import *

def checkForCycles(widget,targetWidget):
    noCycles = True
    for c in Connection.objects.filter(input__widget=widget):
        if c.output.widget==targetWidget:
            noCycles = False
            return False
        noCycles = noCycles and checkForCycles(c.output.widget,targetWidget)
        if noCycles == False:
            return False
    return noCycles