summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/index.py b/index.py
index ebb4c60..2640667 100644
--- a/index.py
+++ b/index.py
@@ -13,6 +13,9 @@ from mod_python.util import redirect
# import mysql bindings
import MySQLdb
+# trac.ini parsing
+import trac.config
+
# import other common stuff
from random import choice
import base64, cracklib, sha, string, os
@@ -415,3 +418,47 @@ def members(req, **formdata):
c['proj'] = proj
return render_to_string("members.html", c)
+
+
+def del_profile(req):
+ (c, s, cursor) = session_start(req, False)
+
+ cursor.execute("delete from user where login = %s", (s['login'], ))
+ req.dbc.commit()
+
+ s['login'] = None
+ s.save()
+
+ c['info_msg'] = "your profile has been deleted successfully"
+
+ return render_to_string("index.html", c)
+
+
+def list_projects(req):
+ (c, s, cursor) = session_start(req, None)
+
+ cursor.execute("SELECT project_name FROM project WHERE private = 0 AND project_name != 'ALL' ORDER BY project_name")
+ result = cursor.fetchall()
+
+ c['public_projects'] = []
+
+ for project in result:
+ ini = trac.config.Configuration('/var/lib/trac/' + project[0] + '/conf/trac.ini')
+ c['public_projects'].append((project[0], ini.get('project', 'name'), ini.get('project','descr')))
+
+ cursor.execute("SELECT project_name FROM project WHERE private = 1 AND project_name != 'ALL' ORDER BY project_name")
+ result = cursor.fetchall()
+
+ c['private_projects'] = []
+
+ for project in result:
+ ini = trac.config.Configuration('/var/lib/trac/' + project[0] + '/conf/trac.ini')
+ c['private_projects'].append((project[0], ini.get('project', 'name'), ini.get('project','descr')))
+
+ return render_to_string("list_projects.html", c)
+
+
+# this is returned whenever a db error occurs
+def db_error(req):
+ return render_to_string("db_error.html")
+