]> git.siccegge.de Git - fachschaftentool.git/blobdiff - application.py
Update Fachschaftentool
[fachschaftentool.git] / application.py
index 8ceb6c9e74c6bf45737c884ea7179d47abd22d25..c296f31413debd4352aaf81e859c66537f3835ea 100644 (file)
@@ -10,8 +10,8 @@ from flask import Flask, session, redirect, url_for, escape, request, render_tem
 
 app = Flask(__name__)
 
-#DATABASE = os.path.join(os.path.dirname(__file__), '..', 'data', 'fachschaften.sqlite')
-DATABASE = os.path.join(os.path.dirname(__file__), 'fachschaften.sqlite')
+DATABASE = os.path.join(os.path.dirname(__file__), '..', 'data', 'fachschaften.sqlite')
+#DATABASE = os.path.join(os.path.dirname(__file__), 'fachschaften.sqlite')
 
 def get_db():
     db = sqlite3.connect(DATABASE)
@@ -42,13 +42,11 @@ def add_process():
     db = get_db()
     cursor = db.cursor()
     data = request.form
-
-    print data
     
     cursor.execute("INSERT INTO fachschaft "
                    "(langname, kurzname, land, stadt, studenten, "
-                   "organ, vertreten, organisation, fachschaftler) "
-                   "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
+                   "organ, vertreten, organisation, fachschaftler, homepage) "
+                   "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                    [data['unilang'],
                     data['unikurz'],
                     data['bundesland'],
@@ -57,7 +55,8 @@ def add_process():
                     data['fsorgan'],
                     data['vertretenestudis'],
                     data['organisationsform'],
-                    data['aktive']])
+                    data['aktive'],
+                    data['homepage']])
     rowid = cursor.lastrowid
     for i in range(0, 10):
         if data['studiengang%d' % i] != '':
@@ -83,7 +82,7 @@ def download():
                                fachschaft = fachschaft,
                                studiengaenge = studiengaenge)
         fdata = fdata.encode('utf-8')
-        info = tarfile.TarInfo(name=fachschaft['kurzname'])
+        info = tarfile.TarInfo(name='%s.tex' % fachschaft['kurzname'].strip().lower().replace(' ', '_').replace('/','_'))
         info.size = len(fdata)
         tar.addfile(info, StringIO.StringIO(fdata))
         print fdata