Commit 45279a4f authored by Janez K's avatar Janez K

checking for cycles using a topology sort

parent ceab2739
......@@ -151,14 +151,7 @@ LOGGING = {
}
}
try:
LOCAL_SETTINGS
except NameError:
try:
from local_settings import *
except ImportError:
pass
USE_CONCURRENCY = False
INSTALLED_APPS_DEFAULT = (
'django.contrib.auth',
......@@ -217,6 +210,14 @@ INSTALLED_APPS = \
INSTALLED_APPS_CONCUR +\
INSTALLED_APPS_WORKFLOWS_SUB
try:
LOCAL_SETTINGS
except NameError:
try:
from local_settings import *
except ImportError:
pass
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS
TEMPLATES_FOLDER = os.path.join(PROJECT_DIR, 'templates')
......
This diff is collapsed.
from workflows.models import *
from workflows.toposort import toposort
def checkForCycles(widget,targetWidget):
pairs = []
for c in widget.workflow.connections.select_related("output","input").defer("output__value","input__value").all():
if not (c.output.widget_id,c.input.widget_id) in pairs:
pairs.append((c.output.widget_id,c.input.widget_id))
try:
toposort(pairs,None,True,True)
except:
return False
return True
def slowCheckForCycles(widget,targetWidget):
noCycles = True
for c in Connection.objects.filter(input__widget=widget):
if Widget.objects.get(outputs__pk=c.output_id)==targetWidget:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment