summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@dev.spline.de>2008-10-27 18:56:48 +0100
committerroot <root@dev.spline.de>2008-10-27 18:56:48 +0100
commit0f7ed51935e8a49af547b75842a494b265eb90d2 (patch)
treebc6197043999e3b603139e86ff1ecb3954397b7f
parent661617e90d01c6dd6f62b320c40e00712f1123c0 (diff)
downloaddev-account-0f7ed51935e8a49af547b75842a494b265eb90d2.tar.gz
dev-account-0f7ed51935e8a49af547b75842a494b265eb90d2.tar.xz
dev-account-0f7ed51935e8a49af547b75842a494b265eb90d2.zip
add list_project, del_profile and db_error handlers
-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")
+