| Conditions | 2 |
| Total Lines | 15 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | from django.core.management.base import BaseCommand |
||
| 10 | def handle(self, *args, **options): |
||
| 11 | try: |
||
| 12 | user = User.objects.get(username=args[0]) |
||
| 13 | except Exception: |
||
| 14 | print "Unknown user, try one of these:" |
||
| 15 | print User.objects.all() |
||
| 16 | exit(1) |
||
| 17 | assert(args[1] in ('faulttree', 'fuzztree')) |
||
| 18 | project = Project(owner=user, name="Imported graph") |
||
| 19 | project.save() |
||
| 20 | graph = Graph(owner=user, kind=args[1], project=project) |
||
| 21 | graph.save() |
||
| 22 | xmldata = open(args[2]).read() |
||
| 23 | graph.from_graphml(xmldata) |
||
| 24 | print "Graph created, ID is %u" % graph.pk |
||
| 25 |