def create_nodes_for_path(path, authors=()): nodes, last = parse_path(path) current_node = get_root_node() current_path = "" for short_title, index in nodes: # slot current_path += '/' + short_title try: current_slot = get_node_for_path(current_path) except IllegalPath: current_slot = create_slot(short_title) current_node.append_child(current_slot) # alternatives current_path += '.' + str(index) try: current_node = get_node_for_path(current_path) except IllegalPath: if current_slot.child_order_set.count() == 0: highest_index = 0 else: highest_index = current_slot.child_order_set.order_by( 'position')[0].position for i in range(highest_index, index): current_node = create_structureNode(short_title + '_long', authors=authors) current_slot.append_child(current_node) return current_node
def setUp(self): self.max = create_user('max') self.root = get_root_node() self.bla = create_slot("Bla") self.root.append_child(self.bla) self.bla1 = create_structureNode('Bla ist Bla', "Das musste gesagt werden.", [self.max]) self.bla.append_child(self.bla1) self.blubb = create_slot("Blubb") self.bla1.append_child(self.blubb) self.blubb1 = create_textNode("Blubb ist eins", "Gesagt ist gedacht.", [self.max]) self.blubb.append_child(self.blubb1) self.blubb2 = create_textNode("Blubb die Zweite", "Geschrieben ist notiert.", [self.max]) self.blubb.append_child(self.blubb2) self.blubb2d = create_textNode("Blubb die Zweite", "Geschrieben ist anders notiert.", [self.max]) self.blubb.append_child(self.blubb2d) self.blubb2.add_derivate(self.blubb2d) self.bla2 = create_textNode("Follopp", "Globbern!", [self.max]) self.bla.append_child(self.bla2) self.bla2.add_derivate(self.blubb2) self.bla3 = create_textNode("Folloppiii", "Globbern! Den ganzen Tag.", [self.max]) self.bla.append_child(self.bla3) self.blubb2.add_derivate(self.bla3) self.bla4 = create_textNode("Flop", "Glob!", [self.max]) self.bla.append_child(self.bla4) self.bla3.add_derivate(self.bla4)
def setUp(self): self.root = get_root_node() self.hugo = create_user("Hugo", password="******", groups=['voters']) self.ulf = create_user("Ulf", password="******", groups=['voters']) self.permela = create_user("Permela", password="******") self.slot = create_slot("Slot") self.root.append_child(self.slot) self.text = create_textNode("Bla", "Blubb", [self.hugo]) self.slot.append_child(self.text) self.mid = create_textNode("Bla derivate", "Blubb2", [self.hugo]) self.slot.append_child(self.mid) self.text.add_derivate(self.mid, arg_type='c', title="dagegen") self.leaf1 = create_textNode("Bla leaf 1", "Blubb3", [self.hugo]) self.slot.append_child(self.leaf1) self.mid.add_derivate(self.leaf1, arg_type='c', title="dagegen2") self.mid2 = create_textNode("Bla derivate 2", "Blubb4", [self.hugo]) self.slot.append_child(self.mid2) self.mid.add_derivate(self.mid2, arg_type='c', title="dagegen") self.leaf2 = create_textNode("Bla leaf 2", "Blubb5", [self.hugo]) self.slot.append_child(self.leaf2) self.mid2.add_derivate(self.leaf2, arg_type='c', title="dagegen") self.follow = create_vote(self.hugo, [self.text, self.mid, self.leaf1, self.mid2, self.leaf2]) self.arg1 = create_argument(self.text, "con", "Wrong!", "Bad!", [self.hugo])
def load_graph_data(request, path, graph_data_type): if not path.strip("/"): # root node! nodes = [backend.get_root_node()] # related_nodes = [] else: slot_path = path.rsplit(".", 1)[0] slot = assert_node_for_path(slot_path) if graph_data_type == "withSpam": # This means display ALL nodes nodes = backend.get_ordered_children_for(slot) else: # if graph_data_type == 'full': nodes = ( backend.Node.objects.filter(parents=slot) .annotate(spam_count=Count("spam_flags", distinct=True)) .filter(spam_count__lt=2) .filter(votes__isnull=False) ) current_node = backend.get_node_for_path(path) nodes = list(nodes) if current_node not in nodes: nodes.append(current_node) graph_data_children = map(create_graph_data_node_for_structure_node, nodes) data = {"graphDataChildren": graph_data_children, "graphDataRelated": []} return json_response({"loadGraphDataResponse": data})
def setUp(self): self.hans = create_user('hans') self.hugo = create_user('hugo') self.root = get_root_node() self.slot1 = create_slot('Wahlprogramm') self.root.append_child(self.slot1) self.textnode1 = create_textNode('LangerWahlprogrammTitel', authors=[self.hans]) self.slot1.append_child(self.textnode1) self.slot2 = create_slot('Grundsatzprogramm') self.root.append_child(self.slot2) self.textnode2 = create_textNode('LangerGrundsatzTitel', authors=[self.hugo]) self.slot2.append_child(self.textnode2) self.slot3 = create_slot('Organisatorisches') self.root.append_child(self.slot3) self.textnode31 = create_textNode('Langweilig1', authors=[self.hans]) self.textnode32 = create_textNode('Langweilig2', authors=[self.hugo]) self.textnode33 = create_textNode('Langweilig3', authors=[self.hans, self.hugo]) self.slot3.append_child(self.textnode31) self.slot3.append_child(self.textnode32) self.slot3.append_child(self.textnode33) create_vote(self.hans, [self.textnode33]) self.top_slots = [self.slot1, self.slot2, self.slot3] self.short_titles = ['Wahlprogramm', 'Grundsatzprogramm', 'Organisatorisches'] self.full_titles = ['LangerWahlprogrammTitel', 'LangerGrundsatzTitel', 'Langweilig3'] self.authors = [[self.hans], [self.hugo], [self.hans, self.hugo]]
def setUp(self): self.hans = create_user('hans') self.hugo = create_user('hugo') self.root = get_root_node() self.slot1 = create_slot('Wahlprogramm') self.root.append_child(self.slot1) self.structureNode1 = create_structureNode('LangerWahlprogrammTitel', authors=[self.hans]) self.slot1.append_child(self.structureNode1) self.slot11 = create_slot('Transparenz') self.structureNode1.append_child(self.slot11) self.textnode11 = create_textNode('Traaaansparenz', authors=[self.hans]) self.slot11.append_child(self.textnode11) self.slot12 = create_slot('Bildung') self.structureNode1.append_child(self.slot12) self.textnode12 = create_textNode('Biiildung', authors=[self.hans]) self.slot12.append_child(self.textnode12) self.slot13 = create_slot('Datenschutz') self.structureNode1.append_child(self.slot13) self.textnode13 = create_textNode('Daaatenschutz', authors=[self.hans]) self.slot13.append_child(self.textnode13) self.arguments = [] for i in range(1, 25): arg = create_argument(self.textnode11, 'p', "Argument" + str(i), "Text of argument no. " + str(i), [self.hugo, self.hans]) create_vote(self.hugo, [arg]) if i % 2 == 1: create_vote(self.hans, [arg]) create_spam_flag(self.hugo, [arg]) self.arguments.append(arg)
def setUp(self): self.root = get_root_node() self.hugo = create_user("Hugo", password="******", groups=['voters']) self.ulf = create_user("Ulf", password="******", groups=['voters']) self.permela = create_user("Permela", password="******") self.slot = create_slot("Slot") self.root.append_child(self.slot) self.text = create_textNode("Bla", "Blubb", [self.hugo]) self.slot.append_child(self.text) self.mid = create_textNode("Bla derivate", "Blubb2", [self.hugo]) self.slot.append_child(self.mid) self.text.add_derivate(self.mid, arg_type='c', title="dagegen") self.leaf1 = create_textNode("Bla leaf 1", "Blubb3", [self.hugo]) self.slot.append_child(self.leaf1) self.mid.add_derivate(self.leaf1, arg_type='c', title="dagegen2") self.mid2 = create_textNode("Bla derivate 2", "Blubb4", [self.hugo]) self.slot.append_child(self.mid2) self.mid.add_derivate(self.mid2, arg_type='c', title="dagegen") self.leaf2 = create_textNode("Bla leaf 2", "Blubb5", [self.hugo]) self.slot.append_child(self.leaf2) self.mid2.add_derivate(self.leaf2, arg_type='c', title="dagegen") self.follow = create_vote( self.hugo, [self.text, self.mid, self.leaf1, self.mid2, self.leaf2]) self.arg1 = create_argument(self.text, "con", "Wrong!", "Bad!", [self.hugo])
def setUp(self): self.root = get_root_node() self.mustermann = create_user("Mustermann") self.slot = create_slot("Flopp") self.root.append_child(self.slot) self.text1 = create_textNode("Initial Text", "Dumdidum", [self.mustermann]) self.slot.append_child(self.text1)
def create_topic(src_path, topic_name): print("Creating '%s' from file '%s'." % (topic_name, src_path)) root = get_root_node() decided = User.objects.get(username="******") slot = create_slot(topic_name) root.append_child(slot) with open(src_path, 'r') as src: schema = parse(unicode(src.read(), encoding='utf-8'), slot.title) create_structure_from_structure_node_schema(schema, slot, decided)
def setUp(self): self.root = get_root_node() self.hugo = create_user("Hugo", password="******", groups=['voters']) self.slot = create_slot("Slot") self.root.append_child(self.slot) self.text = create_textNode("Bla", "Dieser Text enthält verschiedene Suchbegriffe wie Giraffe, Huhn, Motorrad und Tisch.", [self.hugo]) self.slot.append_child(self.text) self.post1 = create_post("Ich finde /Slot.1 Huhn.", self.hugo) self.post1 = create_post("Giraffe Huhn.", self.hugo)
def setUp(self): self.root = get_root_node() self.hugo = create_user("Hugo", password="******", groups=['texters', 'voters', 'bloggers']) create_user("Notpermitted", password="******") self.slot = create_slot("Slot") self.root.append_child(self.slot) self.text = create_textNode("Slotteria", "This is a textnode", authors=[self.hugo]) self.slot.append_child(self.text) self.url = reverse('store_text', kwargs=dict(path="Slot.1"))
def setUp(self): self.root = get_root_node() self.mustermann = create_user("Mustermann") self.slot = create_slot("Flopp") self.root.append_child(self.slot) self.text1 = create_textNode("Initial Text", "Dumdidum", [self.mustermann]) self.slot.append_child(self.text1) self.text2 = create_textNode("Secondary Text", "Dudelda", [self.mustermann]) self.slot.append_child(self.text2) self.text1.add_derivate(self.text2)
def setUp(self): self.root = get_root_node() self.hugo = create_user("Hugo", password="******", groups=['voters']) self.slot = create_slot("Slot") self.root.append_child(self.slot) self.text = create_textNode( "Bla", "Dieser Text enthält verschiedene Suchbegriffe wie Giraffe, Huhn, Motorrad und Tisch.", [self.hugo]) self.slot.append_child(self.text) self.post1 = create_post("Ich finde /Slot.1 Huhn.", self.hugo) self.post1 = create_post("Giraffe Huhn.", self.hugo)
def setUp(self): self.hans = create_user('hans') self.hugo = create_user('hugo') self.root = get_root_node() self.slot1 = create_slot('Wahlprogramm') self.root.append_child(self.slot1) self.textnode1 = create_textNode('LangerWahlprogrammTitel', authors=[self.hans]) self.slot1.append_child(self.textnode1) self.slot2 = create_slot('Grundsatzprogramm') self.root.append_child(self.slot2) self.textnode2 = create_textNode('LangerGrundsatzTitel', authors=[self.hugo]) self.slot2.append_child(self.textnode2) self.slot3 = create_slot('Organisatorisches') self.root.append_child(self.slot3) self.textnode31 = create_textNode('Langweilig1', authors=[self.hans]) self.textnode32 = create_textNode('Langweilig2', authors=[self.hugo]) self.textnode33 = create_textNode('Langweilig3', authors=[self.hans, self.hugo]) self.slot3.append_child(self.textnode31) self.slot3.append_child(self.textnode32) self.textnode32d = create_textNode('Langweilig2 anders', authors=[self.hans, self.hugo]) self.slot3.append_child(self.textnode32d) self.textnode32.add_derivate(self.textnode32d) create_vote(self.hans, [self.textnode32, self.textnode32d]) self.slot3.append_child(self.textnode33) self.textnode33d = create_textNode('Langweilig3 anders', authors=[self.hans, self.hugo]) self.slot3.append_child(self.textnode33d) self.textnode33.add_derivate(self.textnode33d) create_spam_flag(self.hugo, [self.textnode33d]) create_vote(self.hans, [self.textnode33]) self.nodes = [self.textnode31, self.textnode32, self.textnode32d, self.textnode33, self.textnode33d] self.authorGroups = [[create_user_info(self.hans)], [create_user_info(self.hugo)], [create_user_info(self.hans), create_user_info(self.hugo)], [create_user_info(self.hans), create_user_info(self.hugo)], [create_user_info(self.hans), create_user_info(self.hugo)]] self.follows = [0, 1, 1, 1, 0] self.spamFlags = [0, 0, 0, 0, 1] self.unFollows = [0, 0, 0, 0, 1] self.newFollows = [0, 1, 0, 1, 0] self.originGroups = [[], [], ['Organisatorisches.2'], [], ['Organisatorisches.4']]
def setUp(self): self.root = get_root_node() self.hugo = create_user("Hugo", password="******", groups=['voters']) self.permela = create_user("Permela", password="******") self.slot = create_slot("Slot") self.root.append_child(self.slot) self.text = create_textNode("Bla", "Blubb", [self.hugo]) self.slot.append_child(self.text) self.mid = create_textNode("Bla derivate", "Blubb2", [self.hugo]) self.slot.append_child(self.mid) self.text.add_derivate(self.mid, arg_type='n') self.leaf = create_textNode("Bla leaf 1", "Blubb3", [self.hugo]) self.slot.append_child(self.leaf) self.mid.add_derivate(self.leaf, arg_type='n')
def setUp(self): self.hans = create_user('hans') self.hugo = create_user('hugo') self.root = get_root_node() self.slot1 = create_slot('Wahlprogramm') self.root.append_child(self.slot1) self.structureNode1 = create_structureNode('LangerWahlprogrammTitel', authors=[self.hans]) self.slot1.append_child(self.structureNode1) self.slot11 = create_slot('Transparenz') self.structureNode1.append_child(self.slot11) self.textnode11 = create_textNode('Traaaansparenz', authors=[self.hans]) self.slot11.append_child(self.textnode11) self.slot12 = create_slot('Bildung') self.structureNode1.append_child(self.slot12) self.textnode12 = create_textNode('Biiildung', authors=[self.hans]) self.slot12.append_child(self.textnode12) self.slot13 = create_slot('Datenschutz') self.structureNode1.append_child(self.slot13) self.textnode13 = create_textNode('Daaatenschutz', authors=[self.hans]) self.slot13.append_child(self.textnode13) self.slot2 = create_slot('Grundsatzprogramm') self.root.append_child(self.slot2) self.textnode2 = create_textNode('LangerGrundsatzTitel', authors=[self.hugo]) self.slot2.append_child(self.textnode2) self.slot3 = create_slot('Organisatorisches') self.root.append_child(self.slot3) self.textnode31 = create_textNode('Langweilig1', authors=[self.hans]) self.textnode32 = create_textNode('Langweilig2', authors=[self.hugo]) self.textnode33 = create_textNode('Langweilig3', authors=[self.hans, self.hugo]) self.slot3.append_child(self.textnode31) self.slot3.append_child(self.textnode32) self.slot3.append_child(self.textnode33) create_vote(self.hans, [self.textnode33]) self.top_slots = [self.slot1, self.slot2, self.slot3] self.child_slots = [self.slot11, self.slot12, self.slot13] self.short_titles = [ 'Wahlprogramm', 'Grundsatzprogramm', 'Organisatorisches' ] self.full_titles = [ 'LangerWahlprogrammTitel', 'LangerGrundsatzTitel', 'Langweilig3' ] self.authors = [[self.hans], [self.hugo], [self.hans, self.hugo]]
def setUp(self): self.user_max = create_user("max",password="******") self.user_maria = create_user("Maria") root = backend.get_root_node() slot1 = create_slot("Bla") root.append_child(slot1) self.text_node1 = create_textNode("Whatever","Testtext",[self.user_max]) slot1.append_child(self.text_node1) slot2 = create_slot("Blubb") root.append_child(slot2) text_node2 = create_textNode("Whatever2","Testtext Nummer 2",[self.user_max]) slot2.append_child(text_node2)
def setUp(self): self.hans = create_user('hans') self.hugo = create_user('hugo') self.root = get_root_node() self.slot1 = create_slot('Wahlprogramm') self.root.append_child(self.slot1) self.structureNode1 = create_structureNode('LangerWahlprogrammTitel', authors=[self.hans]) self.slot1.append_child(self.structureNode1) self.slot11 = create_slot('Transparenz') self.structureNode1.append_child(self.slot11) self.textnode11 = create_textNode('Traaaansparenz', authors=[self.hans]) self.slot11.append_child(self.textnode11) self.slot12 = create_slot('Bildung') self.structureNode1.append_child(self.slot12) self.textnode12 = create_textNode('Biiildung', authors=[self.hans]) self.slot12.append_child(self.textnode12) self.slot13 = create_slot('Datenschutz') self.structureNode1.append_child(self.slot13) self.textnode13 = create_textNode('Daaatenschutz', authors=[self.hans]) self.slot13.append_child(self.textnode13) self.slot2 = create_slot('Grundsatzprogramm') self.root.append_child(self.slot2) self.textnode2 = create_textNode('LangerGrundsatzTitel', authors=[self.hugo]) self.slot2.append_child(self.textnode2) self.slot3 = create_slot('Organisatorisches') self.root.append_child(self.slot3) self.textnode31 = create_textNode('Langweilig1', authors=[self.hans]) self.textnode32 = create_textNode('Langweilig2', authors=[self.hugo]) self.textnode33 = create_textNode('Langweilig3', authors=[self.hans, self.hugo]) self.slot3.append_child(self.textnode31) self.slot3.append_child(self.textnode32) self.slot3.append_child(self.textnode33) create_vote(self.hans, [self.textnode33]) self.top_slots = [self.slot1, self.slot2, self.slot3] self.child_slots = [self.slot11, self.slot12, self.slot13] self.short_titles = ['Wahlprogramm', 'Grundsatzprogramm', 'Organisatorisches'] self.full_titles = ['LangerWahlprogrammTitel', 'LangerGrundsatzTitel', 'Langweilig3'] self.authors = [[self.hans], [self.hugo], [self.hans, self.hugo]]
def setUp(self): self.hugo = create_user('hugo') # create nodes self.root = get_root_node() self.foo = create_slot('foo') self.root.append_child(self.foo) self.foo1 = create_structureNode('FooooBar') self.foo.append_child(self.foo1) # add arguments self.foo_pro = create_argument(type='pro', text="weils geil ist", authors=[self.hugo]) self.foo1.append_argument(self.foo_pro) self.foo_neut = create_argument(type='neut', text="kann noch geiler werden", authors=[self.hugo]) self.foo1.append_argument(self.foo_neut) self.foo_con = create_argument(type='con', text="is aber leider root", authors=[self.hugo]) self.foo1.append_argument(self.foo_con) # summary variables self.foo_arguments = [self.foo_pro, self.foo_neut, self.foo_con]
def load_graph_data(request, path, graph_data_type): if not path.strip('/'): # root node! nodes = [backend.get_root_node()] related_nodes = [] else: slot_path = path.rsplit('.', 1)[0] slot = assert_node_for_path(slot_path) nodes = backend.get_ordered_children_for(slot) sources = Q(derivates__in=nodes) derivates = Q(sources__in=nodes) related_nodes = backend.Node.objects.filter(sources | derivates). \ exclude(id__in=[n.id for n in nodes]).distinct().all() graph_data_children = map(create_graph_data_node_for_structure_node, nodes) graph_data_related = map(create_graph_data_node_for_structure_node, related_nodes) data = {'graphDataChildren': graph_data_children, 'graphDataRelated': graph_data_related} return json_response({'loadGraphDataResponse': data})
def setUp(self): self.hugo = create_user('hugo') self.hans = create_user('hans') # create nodes self.root = get_root_node() self.foo = create_slot('foo') self.foo1 = create_structureNode('FooooBar') # add arguments self.foo_pro = create_argument(type='pro', title="geil", authors=[self.hugo]) self.foo1.append_argument(self.foo_pro) self.foo_neut = create_argument(type='neut', title="ist", authors=[self.hans]) self.foo1.append_argument(self.foo_neut) self.foo_con = create_argument(type='con', title="geiz", authors=[self.hugo, self.hans]) self.foo1.append_argument(self.foo_con) # summary variables self.foo_arguments = [self.foo_pro, self.foo_neut, self.foo_con] self.arg_titles = ['geil', 'ist', 'geiz'] self.arg_authors = [[self.hugo], [self.hans], [self.hugo, self.hans]]
def setUp(self): self.hans = create_user("hans") self.hugo = create_user("hugo") self.root = get_root_node() self.slot1 = create_slot("Wahlprogramm") self.root.append_child(self.slot1) self.structureNode1 = create_structureNode("LangerWahlprogrammTitel", authors=[self.hans]) self.slot1.append_child(self.structureNode1) self.slot11 = create_slot("Transparenz") self.structureNode1.append_child(self.slot11) self.textnode11 = create_textNode("Traaaansparenz", authors=[self.hans]) self.slot11.append_child(self.textnode11) self.slot12 = create_slot("Bildung") self.structureNode1.append_child(self.slot12) self.textnode12 = create_textNode("Biiildung", authors=[self.hans]) self.slot12.append_child(self.textnode12) self.slot13 = create_slot("Datenschutz") self.structureNode1.append_child(self.slot13) self.textnode13 = create_textNode("Daaatenschutz", authors=[self.hans]) self.slot13.append_child(self.textnode13) self.slot2 = create_slot("Grundsatzprogramm") self.root.append_child(self.slot2) self.textnode2 = create_textNode("LangerGrundsatzTitel", authors=[self.hugo]) self.slot2.append_child(self.textnode2) self.slot3 = create_slot("Organisatorisches") self.root.append_child(self.slot3) self.textnode31 = create_textNode("Langweilig1", authors=[self.hans]) self.textnode32 = create_textNode("Langweilig2", authors=[self.hugo]) self.textnode33 = create_textNode("Langweilig3", authors=[self.hans, self.hugo]) self.slot3.append_child(self.textnode31) self.slot3.append_child(self.textnode32) self.slot3.append_child(self.textnode33) create_vote(self.hans, [self.textnode33]) self.top_slots = [self.slot1, self.slot2, self.slot3] self.child_slots = [self.slot11, self.slot12, self.slot13] self.short_titles = ["Wahlprogramm", "Grundsatzprogramm", "Organisatorisches"] self.full_titles = ["LangerWahlprogrammTitel", "LangerGrundsatzTitel", "Langweilig3"] self.authors = [[self.hans], [self.hugo], [self.hans, self.hugo]]
def setUp(self): self.hugo = create_user('hugo') self.hans = create_user('hans') # create nodes self.root = get_root_node() self.foo = create_slot('foo') self.root.append_child(self.foo) self.foo1 = create_structureNode('FooooBar') self.foo.append_child(self.foo1) # add arguments self.foo_pro = create_argument(self.foo1, arg_type='pro', title="geil", authors=[self.hugo]) self.foo_neut = create_argument(self.foo1, arg_type='neut', title="ist", authors=[self.hans]) self.foo_con = create_argument(self.foo1, arg_type='con', title="geiz", authors=[self.hugo, self.hans]) # summary variables self.foo_arguments = [self.foo_pro, self.foo_neut, self.foo_con] self.arg_titles = ['geil', 'ist', 'geiz'] self.arg_authors = [[self.hugo], [self.hans], [self.hugo, self.hans]]
def load_graph_data(request, path, graph_data_type): if not path.strip("/"): # root node! nodes = [backend.get_root_node()] related_nodes = [] else: slot_path = path.rsplit(".", 1)[0] try: slot = backend.get_node_for_path(slot_path) except backend.IllegalPath: return json_error_response("NonExistingNode", "Could not find slot: " + slot_path + " for node " + path) nodes = backend.get_ordered_children_for(slot) sources = Q(derivates__in=nodes) derivates = Q(sources__in=nodes) related_nodes = ( backend.Node.objects.filter(sources | derivates).exclude(id__in=[n.id for n in nodes]).distinct().all() ) graph_data_children = [create_graph_data_node_for_structure_node(n) for n in nodes] graph_data_related = [create_graph_data_node_for_structure_node(n) for n in related_nodes] data = {"graphDataChildren": graph_data_children, "graphDataRelated": graph_data_related} return json_response({"loadGraphDataResponse": data})
def setUp(self): self.hugo = create_user('hugo') # create nodes self.root = get_root_node() self.foo = create_slot('foo') self.root.append_child(self.foo) self.foo1 = create_structureNode('FooooBar') self.foo.append_child(self.foo1) # add arguments self.foo_pro = create_argument(self.foo1, arg_type='pro', text="weils geil ist", authors=[self.hugo]) self.foo_neut = create_argument(self.foo1, arg_type='neut', text="kann noch geiler werden", authors=[self.hugo]) self.foo_con = create_argument(self.foo1, arg_type='con', text="is aber leider root", authors=[self.hugo]) # summary variables self.foo_arguments = [self.foo_pro, self.foo_neut, self.foo_con]
def setUp(self): self.root = get_root_node() self.hugo = create_user("Hugo", password="******", groups=['voters']) self.permela = create_user("Permela", password="******") self.slot = create_slot("Slot") self.root.append_child(self.slot) self.text = create_textNode("Bla", "Blubb", [self.hugo]) self.slot.append_child(self.text) self.mid = create_textNode("Bla derivate", "Blubb2", [self.hugo]) self.slot.append_child(self.mid) self.text.add_derivate(self.mid, arg_type='n') self.leaf1 = create_textNode("Bla leaf 1", "Blubb3", [self.hugo]) self.slot.append_child(self.leaf1) self.mid.add_derivate(self.leaf1, arg_type='n') self.mid2 = create_textNode("Bla derivate 2", "Blubb4", [self.hugo]) self.slot.append_child(self.mid2) self.mid.add_derivate(self.mid2, arg_type='n') self.leaf2 = create_textNode("Bla leaf 2", "Blubb5", [self.hugo]) self.slot.append_child(self.leaf2) self.mid2.add_derivate(self.leaf2, arg_type='n') self.follow = create_vote(self.hugo, [self.text, self.mid, self.leaf1, self.mid2, self.leaf2]) self.driver = webdriver.Firefox() self.driver.implicitly_wait(1)
def load_graph_data(request, path, graph_data_type): if not path.strip('/'): # root node! nodes = [backend.get_root_node()] # related_nodes = [] else: slot_path = path.rsplit('.', 1)[0] slot = assert_node_for_path(slot_path) if graph_data_type == "withSpam": # This means display ALL nodes nodes = backend.get_ordered_children_for(slot) else: # if graph_data_type == 'full': nodes = backend.Node.objects.filter(parents=slot)\ .annotate(spam_count=Count('spam_flags', distinct=True))\ .filter(spam_count__lt=2)\ .filter(votes__isnull=False) current_node = backend.get_node_for_path(path) nodes = list(nodes) if current_node not in nodes: nodes.append(current_node) graph_data_children = map(create_graph_data_node_for_structure_node, nodes) data = {'graphDataChildren': graph_data_children, 'graphDataRelated': []} return json_response({'loadGraphDataResponse': data})
def setUp(self): self.hans = create_user('hans') self.hugo = create_user('hugo') self.root = get_root_node() self.slot1 = create_slot('Wahlprogramm') self.root.append_child(self.slot1) self.structureNode1 = create_structureNode( 'LangerWahlprogrammTitel', text="Einleitungstext", authors=[self.hans]) self.slot1.append_child(self.structureNode1) self.slot11 = create_slot('Transparenz') self.structureNode1.append_child(self.slot11) self.structureNode11 = create_structureNode( 'Traaaansparenz', text="Transparenz ist wichtig.", authors=[self.hans]) self.slot11.append_child(self.structureNode11) self.slot111 = create_slot('Ebene_3') self.structureNode11.append_child(self.slot111) self.structureNode111 = create_structureNode( 'Eeeebeneee 3', authors=[self.hans]) self.slot111.append_child(self.structureNode111) self.slot1111 = create_slot('Ebene_4') self.structureNode111.append_child(self.slot1111) self.structureNode1111 = create_structureNode( 'Eeeebeneee 4', authors=[self.hans]) self.slot1111.append_child(self.structureNode1111) self.slot11111 = create_slot('Ebene_5') self.structureNode1111.append_child(self.slot11111) self.structureNode11111 = create_structureNode( 'Eeeebeneee 5', authors=[self.hans]) self.slot11111.append_child(self.structureNode11111) self.slot111111 = create_slot('Ebene_6') self.structureNode11111.append_child(self.slot111111) self.structureNode111111 = create_structureNode( 'Eeeebeneee 6', authors=[self.hans]) self.slot111111.append_child(self.structureNode111111) self.slot1111111 = create_slot('Ebene_7') self.structureNode111111.append_child(self.slot1111111) self.textnode1111111 = create_textNode( 'Traaaansparenz', text="Auf Ebene 7.", authors=[self.hans]) self.slot1111111.append_child(self.textnode1111111) self.slot12 = create_slot('Bildung') self.structureNode1.append_child(self.slot12) self.textnode12 = create_textNode( 'Biiildung', authors=[self.hans]) self.slot12.append_child(self.textnode12) self.slot13 = create_slot('Datenschutz') self.structureNode1.append_child(self.slot13) self.textnode13 = create_textNode( 'Daaatenschutz', text="Blubb.", authors=[self.hans]) self.slot13.append_child(self.textnode13) self.textnode13_a1 = create_argument( self.textnode13, arg_type='con', title='Dagegen', text="...denn ihr seid dafür", authors=[self.hugo]) self.slot2 = create_slot('Grundsatzprogramm') self.root.append_child(self.slot2) self.textnode2 = create_textNode( 'LangerGrundsatzTitel', authors=[self.hugo]) self.slot2.append_child(self.textnode2) self.slot3 = create_slot('Organisatorisches') self.root.append_child(self.slot3) self.textnode31 = create_textNode('Langweilig1', authors=[self.hans]) self.textnode32 = create_textNode('Langweilig2', authors=[self.hugo]) self.textnode33 = create_textNode( 'Langweilig3', authors=[self.hans, self.hugo]) self.slot3.append_child(self.textnode31) self.slot3.append_child(self.textnode32) self.slot3.append_child(self.textnode33) create_vote(self.hans, [self.textnode33]) self.top_slots = [self.slot1, self.slot2, self.slot3] self.child_slots = [self.slot11, self.slot12, self.slot13] self.short_titles = ['Wahlprogramm', 'Grundsatzprogramm', 'Organisatorisches'] self.full_titles = ['LangerWahlprogrammTitel', 'LangerGrundsatzTitel', 'Langweilig3'] self.authors = [[self.hans], [self.hugo], [self.hans, self.hugo]] self.maxDiff = None
def setUp(self): self.hans = create_user('hans') self.hugo = create_user('hugo') self.root = get_root_node() self.slot1 = create_slot('Wahlprogramm') self.root.append_child(self.slot1) self.structureNode1 = create_structureNode('LangerWahlprogrammTitel', text="Einleitungstext", authors=[self.hans]) self.slot1.append_child(self.structureNode1) self.slot11 = create_slot('Transparenz') self.structureNode1.append_child(self.slot11) self.structureNode11 = create_structureNode( 'Traaaansparenz', text="Transparenz ist wichtig.", authors=[self.hans]) self.slot11.append_child(self.structureNode11) self.slot111 = create_slot('Ebene_3') self.structureNode11.append_child(self.slot111) self.structureNode111 = create_structureNode('Eeeebeneee 3', authors=[self.hans]) self.slot111.append_child(self.structureNode111) self.slot1111 = create_slot('Ebene_4') self.structureNode111.append_child(self.slot1111) self.structureNode1111 = create_structureNode('Eeeebeneee 4', authors=[self.hans]) self.slot1111.append_child(self.structureNode1111) self.slot11111 = create_slot('Ebene_5') self.structureNode1111.append_child(self.slot11111) self.structureNode11111 = create_structureNode('Eeeebeneee 5', authors=[self.hans]) self.slot11111.append_child(self.structureNode11111) self.slot111111 = create_slot('Ebene_6') self.structureNode11111.append_child(self.slot111111) self.structureNode111111 = create_structureNode('Eeeebeneee 6', authors=[self.hans]) self.slot111111.append_child(self.structureNode111111) self.slot1111111 = create_slot('Ebene_7') self.structureNode111111.append_child(self.slot1111111) self.textnode1111111 = create_textNode('Traaaansparenz', text="Auf Ebene 7.", authors=[self.hans]) self.slot1111111.append_child(self.textnode1111111) self.slot12 = create_slot('Bildung') self.structureNode1.append_child(self.slot12) self.textnode12 = create_textNode('Biiildung', authors=[self.hans]) self.slot12.append_child(self.textnode12) self.slot13 = create_slot('Datenschutz') self.structureNode1.append_child(self.slot13) self.textnode13 = create_textNode('Daaatenschutz', text="Blubb.", authors=[self.hans]) self.slot13.append_child(self.textnode13) self.textnode13_a1 = create_argument(self.textnode13, arg_type='con', title='Dagegen', text="...denn ihr seid dafür", authors=[self.hugo]) self.slot2 = create_slot('Grundsatzprogramm') self.root.append_child(self.slot2) self.textnode2 = create_textNode('LangerGrundsatzTitel', authors=[self.hugo]) self.slot2.append_child(self.textnode2) self.slot3 = create_slot('Organisatorisches') self.root.append_child(self.slot3) self.textnode31 = create_textNode('Langweilig1', authors=[self.hans]) self.textnode32 = create_textNode('Langweilig2', authors=[self.hugo]) self.textnode33 = create_textNode('Langweilig3', authors=[self.hans, self.hugo]) self.slot3.append_child(self.textnode31) self.slot3.append_child(self.textnode32) self.slot3.append_child(self.textnode33) create_vote(self.hans, [self.textnode33]) self.top_slots = [self.slot1, self.slot2, self.slot3] self.child_slots = [self.slot11, self.slot12, self.slot13] self.short_titles = [ 'Wahlprogramm', 'Grundsatzprogramm', 'Organisatorisches' ] self.full_titles = [ 'LangerWahlprogrammTitel', 'LangerGrundsatzTitel', 'Langweilig3' ] self.authors = [[self.hans], [self.hugo], [self.hans, self.hugo]] self.maxDiff = None
def setUp(self): self.root = get_root_node() self.hans = create_user('hans') self.hugo = create_user('hugo')
def setUp(self): self.root = get_root_node() self.hans = create_user('hans') self.hugo = create_user('hugo') self.foo = create_slot("Foo") self.root.append_child(self.foo)