From 68a31d533aba7490c3f1f812075e8ab6eb9265d0 Mon Sep 17 00:00:00 2001 From: Eevee Date: Thu, 6 Aug 2009 09:43:01 -0700 Subject: [PATCH] Index page lists titles of art in the "art" table. --- floof/config/routing.py | 2 + floof/controllers/main.py | 15 ++++ floof/model/__init__.py | 1 + floof/model/art.py | 12 ++++ floof/public/bg.png | Bin 339 -> 0 bytes floof/public/favicon.ico | Bin 2862 -> 0 bytes floof/public/index.html | 137 ------------------------------------ floof/public/pylons-logo.gif | Bin 2399 -> 0 bytes floof/public/reset.css | 47 +++++++++++++ floof/templates/base.mako | 2 + floof/templates/index.mako | 6 ++ floof/tests/functional/test_main.py | 7 ++ 12 files changed, 92 insertions(+), 137 deletions(-) create mode 100644 floof/controllers/main.py create mode 100644 floof/model/art.py delete mode 100644 floof/public/bg.png delete mode 100644 floof/public/favicon.ico delete mode 100644 floof/public/index.html delete mode 100644 floof/public/pylons-logo.gif create mode 100644 floof/public/reset.css create mode 100644 floof/tests/functional/test_main.py 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 69c1798415dadd81f6fac359d0c05e226ca0981f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 339 zcmeAS@N?(olHy`uVBq!ia0vp^j0_A+Y8-4p)+FTzdLV(~Aa^H*b?0PW0y%6+-tI08 z{~1m)FszNdXaf}CEbxddW?wc6x=<11Hv2m#DR*|dAc};cpTpw>d4n%z@h!mzD_cK zmTJRW2mNEJyc@Qad=RcNS$DroTlV47wV3M~yB3^ut-U%)RVnBpzxAtxviha52jujd^(J<`;#A5l zaz9q3dh?~>q)&dwny)l(J@xESNyW9?)z53^YE3d+e*fT?Ro4WLp47;-SGriE#@_!# g=p?&ospxX?!b*Q3iz6E+0bS1E>FVdQ&MBb@0B==)#Q*>R diff --git a/floof/public/favicon.ico b/floof/public/favicon.ico deleted file mode 100644 index 21e215e337ef0900fd805117ae992f7226269a5c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2862 zcmeHJZ%iCj5Fd7rJy>qv?k)eXcn622KwG5&X>8;!N=l;*Acr~dY_IK=ZsE|Ynv}*r zrGyqF6iBRsB!tsxx8L4}_K(bo>F{c{kDJ&;o@f-~R)wO6}gXkhYC#E39 zPW4{>2>eZiZ#@fKjtfFPl%K*8rxEZ5Y2Ta_V0~fYJ5K!xP!XU#{GC+i3s~o2U=I+F z{wdH}2}gagLld;G9lS3aHAjKv=Yz{{qrNCkeW}gEP@##`&rNVf`k8^2>!Uh3)T;`D%MUh#Yu{z+Wqj_i@6Y#7V2Pc8?=B@y@_0N_(W5a%5hHum2DjT< zDkMKyVz;^7E7Df2h_@-L6L>!HfihdXn|xbJ*5eNs*YY{yQ#N;6_L}%d))u;IYctr| z^$)E{^F8MCIr3^9wGL;x&lekEQ@)W~$MREM^VG7ED!D3Ck~r`C#EjaNW`4o-`MlND z%WiY;!o0WN*~}$&yZ4SxVmjYi^CG+QOrxaFkD8FA*EGiJ729~dd<(C88%%o5u3K>< zkNy=`(z9Ya(j2Cqh7K!g`xP2iZ0um@eaV7ZTYZ?g_Y_+94P(akAXYXqeEtnfB*)0D zZ?~c&PdJ=vH+Ai7vtnI~f(>m9OSdGV<&_Un?EW651D_)OyD;J4HyFR?43=zOhQT%| zl56Z`&lL{M;~Ux(e0oPL#szwjy)}Vs|0gIPyM*%b-;s5kL#gX)6n76}d0jjP+vm6% z__R#Zo4dMI+_q0fb$QCUgs$-$Z0`ul?@UFoa^Gc?2d*M(8AVI?cgR-eeY#hLLrBh4SGaFeb;{Y!;#N z!QzDXMTPf9Z_;e&7>jkI{Ps_%oVj#LIrqkC6o4E)cV$9+O%bwHMm3Oa3`d0@2LZx3v zsqHi5thR>5unRHXR3wyaIwkHn`m4C}_#fu=^=GJV=|cSf8LPQuM~F*x?grjuJRz5) c{MUEJAU$9nl72KBFFNB*H{+Of-+Ise4S{?VMgRZ+ 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 61b2d9ab369e8d161b5c2fd9e484be28d11b2486..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2399 zcmV-l383~zNk%w1VLJgt0M!Ekii(Q!^YeOnbtx$+T3TAy*Vi2#9ipP5=;-K3NJtbD z6eT4k#>U3-%rYS%A)k<085tS2wzh6zD6Nz%JUlzzzB!G1F2bonA0QtxGBGG9Crm^p z8yp)P8yp)N8XFuO92^`P8X6-bA|4(dA0HnlCnqK*CL$stARr(hA0Qte9w;a%BO@au zBqb*(C?q2zBqSs#Cnpsa78n^B7Z(>77#9~878n>95D*X&5)vvZDjORcD=RB+Zf^h9 zF#rGmA^8LW00093EC2ui06PIh000L6z=3c`EE78iP# zn0OZ!j&TG(prN9pq@V}~J%5r;2?PQHiUg~(kan53m<BnYCEvX<`=hwL5I_sL=bWM4J%JH}Gro)>@?PEuf77zjY_qfas{D|ITB zq1augaDFaF?Fo&({hjgvz72@C>7gsDUZWR^*p5^5?s z3Xw#->F5thI-yma3^mY2oDG?a}kf@GE2>J`5O7z%Tq2VN9tgFI6Iz*$;N*iLCXHI+Twz3TY<*pn3 zltC-C5`g1v?hw-d;5(HDVww_glF}}Z%^qJRIoD5HoMC&YZ41_@+dkt9gM^pi|n*}M)VLbcy15MO9E1xSwxU#b{YT!Esjm| z17I)oK-V=tfwN2`-dl<{fQ!;Lv-KEJxhNwgkwMY)8Syb+MkxEY)ru*`xUF<1KFtNI zcl+?!pafn2#N7%4+jl7E3Y~coyXV`)=Apbd`Y19+ zf>l)mMv7#pLMAwoIC(3D?TDAdKq<;!KV;lFJXnDZHco_bDo!k{fWR)1>R3xKVDQq% z1PW3AO-nPm;r6m9q=A{S2LkY51N3LcBEBd92}ooDis*zl{=!71iX-?2pp6LDF&KAr zq`dU_pCk0hY4!*s<2vX%5Ehbu%M-&DDJ8=$dUBH5pyLvVr$SARVv9KBq*M^8!9PN; zl)jW76An3s8g4^@E0kgp-WLTIzN!ee6a_B#_)0~=N|dV$Vx3I+M;IP~m}78eKmy=R z_bF3=O#EMd_;^cQlERgd5@$e=gUxIvjGNs=WiB65rtA^HfUA_H2}KpDJRX6I!;G3x zs8UaRVhW%6L?boDAkPCe!GNEHB5(j0of=NFlMho307X%shOUm3)M)@jBkCommBE7l z0kPyjS=cHOWpF_pvD7##X>YYwvvqb1pM(t*e zrG0II$RfDw4X_#8o60tb=Uua%Byb=bk}4K7zt{EK zKcV#?01NoSjB71#cRL0I##g@Q>=1+B(YYc)_@JFVqS5waVGO&tU>dG%f!pw1t0qgq z(5&w^?kl$jMwo&_7_mE0(&85z*aEFg}*DP+z`w#PvGG5bo_-2a%*TyT!FoaapEI@|fqc+RuAy6jk(SX2tMO@eyR z@?3UGQ_aFi9#A9lS;N-J^-1Q6D-j04pUabpmQfDWR3;W>o6vPVCU zPW3mp(P=r1%N3ewvb_=+1qxXD)|2jm(qNNBRr|UK-{tYIBeBR~8~ee*IPwzS<~%tBB5+Sty*v$M_ZZgatyKk~M?$L%v_lKb4~HgWUP&2DzDlGN>vceagb RV|m*<+V7V2y~z*+06TypDp&vj 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" /> + +
    + % for artwork in c.artwork: +
  • ${artwork.title}
  • + % endfor +
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... -- 2.7.4