From 525fe6090b7ff002198c4a58dc9cb90d774b8cd0 Mon Sep 17 00:00:00 2001 From: Eevee Date: Sun, 4 Oct 2009 21:14:44 -0700 Subject: [PATCH 1/1] Users namespace index and a quick userlist. --- floof/config/routing.py | 3 +++ floof/controllers/users.py | 19 +++++++++++++++++++ floof/templates/users/index.mako | 8 ++++++++ floof/tests/functional/test_users.py | 7 +++++++ 4 files changed, 37 insertions(+) create mode 100644 floof/controllers/users.py create mode 100644 floof/templates/users/index.mako create mode 100644 floof/tests/functional/test_users.py 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... -- 2.7.4