From: Eevee Date: Mon, 5 Oct 2009 04:14:44 +0000 (-0700) Subject: Users namespace index and a quick userlist. X-Git-Url: http://git.veekun.com/zzz-floof.git/commitdiff_plain/525fe6090b7ff002198c4a58dc9cb90d774b8cd0 Users namespace index and a quick userlist. --- diff --git a/floof/config/routing.py b/floof/config/routing.py index c8f9e4e..37be4c2 100644 --- a/floof/config/routing.py +++ b/floof/config/routing.py @@ -29,6 +29,9 @@ def make_map(): map.connect('/account/register', controller='account', action='register') map.connect('/account/register_finish', controller='account', action='register_finish', **require_POST) + map.connect('/users', controller='users', action='list') + map.connect('/users/{name}', controller='users', action='view') + map.connect('/search', controller='search', action='index') return map diff --git a/floof/controllers/users.py b/floof/controllers/users.py new file mode 100644 index 0000000..1758653 --- /dev/null +++ b/floof/controllers/users.py @@ -0,0 +1,19 @@ +import logging + +from pylons import request, response, session, tmpl_context as c +from pylons.controllers.util import abort, redirect_to + +from floof.lib.base import BaseController, render +from floof.model.users import User + +log = logging.getLogger(__name__) + +class UsersController(BaseController): + + def list(self): + """List of all users.""" + + # TODO paging! + c.users = User.query.all() + + return render('/users/index.mako') diff --git a/floof/templates/users/index.mako b/floof/templates/users/index.mako new file mode 100644 index 0000000..b16bbaf --- /dev/null +++ b/floof/templates/users/index.mako @@ -0,0 +1,8 @@ +<%inherit file="/base.mako" /> + + diff --git a/floof/tests/functional/test_users.py b/floof/tests/functional/test_users.py new file mode 100644 index 0000000..cc1aeb1 --- /dev/null +++ b/floof/tests/functional/test_users.py @@ -0,0 +1,7 @@ +from floof.tests import * + +class TestUsersController(TestController): + + def test_index(self): + response = self.app.get(url(controller='users', action='index')) + # Test response...