fedora-accounts dump-group.cgi,1.3,1.4

Toshio Ernie Kuratomi (toshio) fedora-extras-commits at redhat.com
Wed Aug 15 23:45:18 UTC 2007


Author: toshio

Update of /cvs/fedora/fedora-accounts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15137

Modified Files:
	dump-group.cgi 
Log Message:
* Allow selecting people from every group by not specifying a group.



Index: dump-group.cgi
===================================================================
RCS file: /cvs/fedora/fedora-accounts/dump-group.cgi,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dump-group.cgi	17 Aug 2005 14:13:21 -0000	1.3
+++ dump-group.cgi	15 Aug 2007 23:45:15 -0000	1.4
@@ -11,34 +11,42 @@
 
 dbh = website.get_dbh()
 
-groupname = form['group'].value
+if form.has_key('group'):
+    groupname = form['group'].value
+else:
+    groupname = ''
+
 fmt = 'plain'
 if form.has_key('format'):
-	fmt = form['format'].value
+    fmt = form['format'].value
 print "Content-type: text/%s\n" % fmt
 
 dbc = dbh.cursor()
 qry = """
 SELECT person.username, person.email, person.human_name, role.role_type, person.id, role.project_group_id
 FROM role, person, project_group WHERE person.id = role.person_id AND project_group.id = role.project_group_id
-AND person.approval_status = 'approved' AND role.role_status = 'approved' AND project_group.name = %s
+AND person.approval_status = 'approved' AND role.role_status = 'approved'
 """
-qargs = [groupname]
+qargs = []
+if groupname:
+    qry += """ AND project_group.name = %s """
+    qargs.append(groupname)
+
 if form.has_key('role_type'):
     rt = form['role_type'].value
     if rt != 'user':
-	qry += ' AND role.role_type IN %s'
-	if rt == 'sponsor':
-		qargs.append(['sponsor', 'administrator'])
-	elif rt == 'administrator':
-		qargs.append(['administrator'])
+        qry += ' AND role.role_type IN %s'
+        if rt == 'sponsor':
+            qargs.append(['sponsor', 'administrator'])
+        elif rt == 'administrator':
+            qargs.append(['administrator'])
 qry += 'ORDER BY person.username'
 dbc.execute(qry, qargs)
 
 dbc2 = dbh.cursor()
 
 if fmt == 'html':
-	print "<html><head><title>Members of the %s group</title></head><body><table border=1><tr><th>Username</th><th>E-mail address</th><th>Real Name</th><th>Role type</th><th>Sponsored Count</th></tr>" % groupname
+    print "<html><head><title>Members of the %s group</title></head><body><table border=1><tr><th>Username</th><th>E-mail address</th><th>Real Name</th><th>Role type</th><th>Sponsored Count</th></tr>" % groupname
 while 1:
     arow = dbc.fetchone()
     if not arow: break
@@ -46,9 +54,9 @@
     arow[4] = dbc2.fetchone()[0]
     arow = arow[:5]
     if fmt == 'html':
-	print "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>" % tuple(arow)
+        print "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>" % tuple(arow)
     else:
-	print ','.join(map(str, arow))
+        print ','.join(map(str, arow))
 if fmt == 'html':
     print "</table></body></html>"
 dbh.close()




More information about the fedora-extras-commits mailing list