From: Eevee Date: Thu, 6 Aug 2009 16:43:01 +0000 (-0700) Subject: Index page lists titles of art in the "art" table. X-Git-Url: http://git.veekun.com/zzz-floof.git/commitdiff_plain/68a31d533aba7490c3f1f812075e8ab6eb9265d0?ds=sidebyside Index page lists titles of art in the "art" table. --- diff --git a/floof/config/routing.py b/floof/config/routing.py index 1fd081a..f78246a 100644 --- a/floof/config/routing.py +++ b/floof/config/routing.py @@ -20,6 +20,8 @@ def make_map(): map.connect('/error/{action}', controller='error') map.connect('/error/{action}/{id}', controller='error') + map.connect('/', controller='main', action='index') + map.connect('/account/login', controller='account', action='login') map.connect('/account/login_begin', controller='account', action='login_begin', **require_POST) map.connect('/account/login_finish', controller='account', action='login_finish') diff --git a/floof/controllers/main.py b/floof/controllers/main.py new file mode 100644 index 0000000..2b8b877 --- /dev/null +++ b/floof/controllers/main.py @@ -0,0 +1,15 @@ +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 import meta, Art + +log = logging.getLogger(__name__) + +class MainController(BaseController): + + def index(self): + c.artwork = meta.Session.query(Art).order_by(Art.id.desc()).all() + return render('/index.mako') diff --git a/floof/model/__init__.py b/floof/model/__init__.py index e3f810d..d0f03b3 100644 --- a/floof/model/__init__.py +++ b/floof/model/__init__.py @@ -6,6 +6,7 @@ from floof.model import meta # Tables are defined in separate files and imported to here from floof.model.users import * +from floof.model.art import * def init_model(engine): """Call me before using any of the tables or classes in the model""" diff --git a/floof/model/art.py b/floof/model/art.py new file mode 100644 index 0000000..8cfcd5a --- /dev/null +++ b/floof/model/art.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, ForeignKey +from sqlalchemy.orm import relation +from sqlalchemy.types import Integer, Unicode + +from floof.model import meta + +__all__ = ['Art'] + +class Art(meta.TableBase): + __tablename__ = 'art' + id = Column(Integer, primary_key=True) + title = Column(Unicode(length=120), nullable=False) diff --git a/floof/public/bg.png b/floof/public/bg.png deleted file mode 100644 index 69c1798..0000000 Binary files a/floof/public/bg.png and /dev/null differ diff --git a/floof/public/favicon.ico b/floof/public/favicon.ico deleted file mode 100644 index 21e215e..0000000 Binary files a/floof/public/favicon.ico and /dev/null differ diff --git a/floof/public/index.html b/floof/public/index.html deleted file mode 100644 index 0719061..0000000 --- a/floof/public/index.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - Welcome to Pylons! - - - -
-

Welcome to Logo displaying the word Pylons -

-
-
-

Let's begin!

-

If you haven't used Pylons before, start with the beginners' tutorial.

-
- - -
- - diff --git a/floof/public/pylons-logo.gif b/floof/public/pylons-logo.gif deleted file mode 100644 index 61b2d9a..0000000 Binary files a/floof/public/pylons-logo.gif and /dev/null differ diff --git a/floof/public/reset.css b/floof/public/reset.css new file mode 100644 index 0000000..ca33138 --- /dev/null +++ b/floof/public/reset.css @@ -0,0 +1,47 @@ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; +} +/* remember to define focus styles! */ +:focus { + outline: 0; +} +body { + line-height: 1; + color: black; + background: white; +} +ol, ul { + list-style: none; +} +/* tables still need 'cellspacing="0"' in the markup */ +table { + border-collapse: separate; + border-spacing: 0; +} +caption, th, td { + text-align: left; + font-weight: normal; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ""; +} +blockquote, q { + quotes: "" ""; +} + diff --git a/floof/templates/base.mako b/floof/templates/base.mako index 340cdf9..50bed27 100644 --- a/floof/templates/base.mako +++ b/floof/templates/base.mako @@ -3,6 +3,8 @@ ${title()} — Floof + + % if c.user: diff --git a/floof/templates/index.mako b/floof/templates/index.mako index d3c64b9..ce3a112 100644 --- a/floof/templates/index.mako +++ b/floof/templates/index.mako @@ -1 +1,7 @@ <%inherit file="base.mako" /> + + diff --git a/floof/tests/functional/test_main.py b/floof/tests/functional/test_main.py new file mode 100644 index 0000000..3fcac13 --- /dev/null +++ b/floof/tests/functional/test_main.py @@ -0,0 +1,7 @@ +from floof.tests import * + +class TestMainController(TestController): + + def test_index(self): + response = self.app.get(url(controller='main', action='index')) + # Test response...