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')
--- /dev/null
+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')
# 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"""
--- /dev/null
+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)
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <title>Welcome to Pylons!</title>
- <style type="text/css">
- body {
- font-family: arial, helvetica, sans-serif;
- background-color: #ffc900;
- background-image: url(bg.png);
- background-repeat: repeat-x;
- width:100%;
- height:100%;
- margin:0;
- max-height: 100%;
- padding:0;
- border:none;
- line-height:1.4;
- }
- #container {
- color:white;
- background-color:#111;
- position: absolute;
- left: 50%;
- width: 500px;
- margin-left: -300px;
- padding:50px;
- height:100%;
- }
- #footer {
- margin: 120px 0 0 0;
- padding: 3px;
- text-align:center;
- font-size:small;
- background-color:#222;
- letter-spacing: 1px;
- }
- h1 {
- text-align:center;
- font-size:xx-large;
- font-weight:normal;
- margin: 0 0 20px 0;
- border:none;
- padding:0;
- letter-spacing: 5px;
- }
- h2 {
- font-size:xx-large;
- font-weight:normal;
- margin: 0 0 20px 0;
- border:none;
- padding:0;
- }
- hr {
- margin-bottom:30px;
- border: 1px solid #222;
- background-color: #222;
- padding: 2px;
- }
- #logo {
- background-image: url(signum8b_spk.png);
- background-repeat: no-repeat;
- height: 0;
- overflow: hidden;
- padding-top: 99px;
- width: 239px;
- }
- #left {
- float:left;
- width:250px;
- margin:0 50px 0 0;
- border:none;
- padding:0 0 0 10px;
- }
- #right {
- margin:0 0 0 330px;
- border:none;
- padding:0;
- }
- ul {
- list-style:none;
- margin:0;
- border:none;
- padding:0;
- }
- a:visited {
- color:white;
- text-decoration:none;
- }
- a:link {
- color:white;
- text-decoration:none;
- }</style>
- </head>
- <body>
- <div id="container">
- <h1>Welcome to <img src="pylons-logo.gif" alt="Logo displaying the word Pylons"
- style="vertical-align:-15px; width: 250px;"/>
- </h1>
- <hr/>
- <div id="left">
- <h2>Let's begin!</h2>
- <p>If you haven't used Pylons before, start with the <a href="http://pylonshq.com/docs/en/0.9.7/gettingstarted/"
- style="text-decoration:underline;">beginners' tutorial</a>.</p>
- </div>
- <div id="right">
- <h2>Help</h2>
- <ul>
- <li>
- <a href="http://pylonshq.com/docs/en/0.9.7/">Official documentation</a>
- </li>
- <li>
- <a href="http://wiki.pylonshq.com/display/pylonsfaq/Home">FAQ</a>
- </li>
- <li>
- <a href="http://wiki.pylonshq.com/dashboard.action">Wiki</a>
- </li>
- <li>
- <a href="http://wiki.pylonshq.com/display/pylonscommunity/Home#Home-JointheMailingLists">Mailing list</a>
- </li>
- <li>
- <a href="http://wiki.pylonshq.com/display/pylonscommunity/Home#Home-IRC">IRC</a>
- </li>
- <li>
- <a href="http://pylonshq.com/project/pylonshq/roadmap">Bug tracker</a>
- </li>
- </ul>
- </div>
- <div id="footer">
- <a href="http://www.pylonshq.com" style="color: #ccc; text-decoration:none;"
- >www.pylonshq.com</a>
- </div>
- </div>
- </body>
-</html>
--- /dev/null
+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: "" "";
+}
+
<html>
<head>
<title>${title()} — Floof</title>
+<link rel="stylesheet" type="text/css" href="/reset.css">
+<link rel="stylesheet" type="text/css" href="/layout.css">
</head>
<body>
% if c.user:
<%inherit file="base.mako" />
+
+<ul class="artwork-grid">
+ % for artwork in c.artwork:
+ <li>${artwork.title}</li>
+ % endfor
+</ul>
--- /dev/null
+from floof.tests import *
+
+class TestMainController(TestController):
+
+ def test_index(self):
+ response = self.app.get(url(controller='main', action='index'))
+ # Test response...