Mercurial > public > src > rhodecode
diff pylons_app/controllers/users.py @ 48:8e250e86a670
Css fixes, implemented removal of users, and display draft
author | Marcin Kuzminski <marcin@python-blog.com> |
---|---|
date | Wed, 07 Apr 2010 21:10:43 +0200 |
parents | f6ac79182600 |
children | 3ada2f409c1c |
line wrap: on
line diff
--- a/pylons_app/controllers/users.py Wed Apr 07 20:19:25 2010 +0200 +++ b/pylons_app/controllers/users.py Wed Apr 07 21:10:43 2010 +0200 @@ -16,14 +16,15 @@ c.staticurl = g.statics c.admin_user = session.get('admin_user') c.admin_username = session.get('admin_username') + self.conn, self.cur = auth.get_sqlite_conn_cur() def index(self, format='html'): """GET /users: All items in the collection""" # url('users') - conn, cur = auth.get_sqlite_conn_cur() - cur.execute('SELECT * FROM users') - c.users_list = cur.fetchall() - return render('/users_manage.html') + + self.cur.execute('SELECT * FROM users') + c.users_list = self.cur.fetchall() + return render('/users.html') def create(self): """POST /users: Create a new item""" @@ -50,11 +51,22 @@ # h.form(url('user', id=ID), # method='delete') # url('user', id=ID) - + try: + self.cur.execute("DELETE FROM users WHERE user_id=?", (id,)) + self.conn.commit() + except: + self.conn.rollback() + raise + return redirect(url('users')) + def show(self, id, format='html'): """GET /users/id: Show a specific item""" # url('user', id=ID) - + self.cur.execute("SELECT * FROM users WHERE user_id=?", (id,)) + ret = self.cur.fetchone() + c.user_name = ret[1] + return render('/users_show.html') + def edit(self, id, format='html'): """GET /users/id/edit: Form to edit an existing item""" # url('edit_user', id=ID)