Unterstütze uns! Spende jetzt!

Änderungen

Wechseln zu: Navigation, Suche

Benutzer:Hub/antragsfabrik-openslides-export.py

775 Bytes hinzugefügt, 11:06, 20. Jun. 2012
update Reihenfolge aus TO auslesen
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
if application["Eingereicht"] != "":
applications_for_category.append(application)
applications_for_category.sort(key = lambda xa: xa["Titel"])
applications[category] = applications_for_category
return applications
def write_content(applications, applications_position=[]): open_position = [] open_position.extend(applications_position)
for category in applications:
f = open(category,'w+')
"Submitter (First Name)","Submitter (Last Name)"))
for a in applications[category]:
try: number = applications_position.index(a["Titel"]) + 1 open_position.remove(a["Titel"]) except ValueError: print '"' + a["Titel"] + '" im Antragsbuch nicht gefunden' number = "" writer.writerow( ( ""number,# number starts at 1
a["Titel"].encode('utf8'),
filter_content(a["Antragstext"].encode('utf8')),
f.flush()
f.close()
if open_position != []:
print "Anträge aus dem Antragsbuch, die nicht gefunden wurden: "
for a in open_position:
print a
 
def get_application_positions(filename):
f = open(filename,'r')
lines = [l.strip().decode('utf8') for l in f.readlines()]
return lines
if __name__ == '__main__':
content = list_content(applications)
applications = parse_content(content)
#Ein Titel per Zeile, TO-Reihenfolge gegeben #positions = get_application_positions("reihenfolge-to") write_content(applications, positions)
168
Bearbeitungen

Navigationsmenü