sql names

This commit is contained in:
j 2007-03-20 16:09:12 +00:00
parent 6d8c3a0744
commit 2f015418f0
7 changed files with 22 additions and 188 deletions

View file

@ -25,7 +25,7 @@ class View:
@expose()
def default(self, id, *args, **kw):
try:
item = ArchiveItem.byHash(id)
item = ArchiveItem.byHashId(id)
if not args:
return self.view(item)
elif args[0] == 'icon.png':
@ -38,6 +38,8 @@ class View:
class Root(controllers.RootController):
view = View()
@expose(template=".templates.welcome")
# @identity.require(identity.in_group("admin"))
def index(self):

View file

@ -13,7 +13,7 @@ __connection__ = hub
class ArchiveItem(SQLObject):
hash = UnicodeCol(alternateId = True)
hashId = UnicodeCol(alternateID = True, length=128)
title = UnicodeCol()
description = UnicodeCol()
author = UnicodeCol()

View file

@ -25,7 +25,7 @@ def icon(item):
icon_root = join(cache_root, 'icon')
if not exists(icon_root):
os.makedirs(icon_root)
icon = join(icon_root, "%s.png" % item.hash)
icon = join(icon_root, "%s.png" % item.hashId)
if exists(icon):
data = laod_file(icon)
else:

View file

@ -1,124 +0,0 @@
/*
* Quick mash-up of CSS for the TG quick start page.
*/
html, body, th, td {
color: black;
background-color: #ddd;
font: x-small "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, sans-serif;
margin: 0;
padding: 0;
}
#header {
height: 80px;
width: 777px;
background: blue URL('../images/header_inner.png') no-repeat;
border-left: 1px solid #aaa;
border-right: 1px solid #aaa;
margin: 0 auto 0 auto;
}
a.link, a, a.active {
color: #369;
}
#main_content {
color: black;
font-size: 127%;
background-color: white;
width: 757px;
margin: 0 auto 0 auto;
border-left: 1px solid #aaa;
border-right: 1px solid #aaa;
padding: 10px;
}
#sidebar {
border: 1px solid #aaa;
background-color: #eee;
margin: 0.5em;
padding: 1em;
float: right;
width: 200px;
font-size: 88%;
}
#sidebar h2 {
margin-top: 0;
}
#sidebar ul {
margin-left: 1.5em;
padding-left: 0;
}
h1,h2,h3,h4,h5,h6,#getting_started_steps {
font-family: "Century Schoolbook L", Georgia, serif;
font-weight: bold;
}
h2 {
font-size: 150%;
}
#getting_started_steps a {
text-decoration: none;
}
#getting_started_steps a:hover {
text-decoration: underline;
}
#getting_started_steps li {
font-size: 80%;
margin-bottom: 0.5em;
}
#getting_started_steps h2 {
font-size: 120%;
}
#getting_started_steps p {
font: 100% "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, sans-serif;
}
#footer {
border: 1px solid #aaa;
border-top: 0px none;
color: #999;
background-color: white;
padding: 10px;
font-size: 80%;
text-align: center;
width: 757px;
margin: 0 auto 1em auto;
}
.code {
font-family: monospace;
}
span.code {
font-weight: bold;
background: #eee;
}
#status_block {
margin: 0 auto 0.5em auto;
padding: 15px 10px 15px 55px;
background: #cec URL('../images/ok.png') left center no-repeat;
border: 1px solid #9c9;
width: 450px;
font-size: 120%;
font-weight: bolder;
}
.notice {
margin: 0.5em auto 0.5em auto;
padding: 15px 10px 15px 55px;
width: 450px;
background: #eef URL('../images/info.png') left center no-repeat;
border: 1px solid #cce;
}

View file

@ -20,29 +20,22 @@
</head>
<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'" py:attrs="item.items()">
<div py:if="tg.config('identity.on',False) and not 'logging_in' in locals()"
id="pageLogin">
<span py:if="tg.identity.anonymous">
<a href="/login">Login</a>
</span>
<span py:if="not tg.identity.anonymous">
Welcome ${tg.identity.user.display_name}.
<a href="/logout">Logout</a>
</span>
</div>
<div id="header">&nbsp;</div>
<div id="main_content">
<div py:if="tg_flash" class="flash" py:content="tg_flash"></div>
<div py:if="tg.config('identity.on',False) and not 'logging_in' in locals()"
id="pageLogin">
<span py:if="tg.identity.anonymous">
<a href="/login">Login</a>
</span>
<span py:if="not tg.identity.anonymous">
Welcome ${tg.identity.user.display_name}.
<a href="/logout">Logout</a>
</span>
</div>
<div id="header">&nbsp;</div>
<div id="main_content">
<div py:if="tg_flash" class="flash" py:content="tg_flash"></div>
<div py:replace="[item.text]+item[:]"/>
<!-- End of main_content -->
</div>
<div id="footer"> <img src="/static/images/under_the_hood_blue.png" alt="TurboGears under the hood" />
<p>TurboGears is a open source front-to-back web development
framework written in Python</p>
<p>Copyright &copy; 2006 Kevin Dangoor</p>
</div>
<div py:replace="[item.text]+item[:]"/>
</div>
</body>
</html>

View file

@ -8,7 +8,7 @@
<body>
<div class="item">
<img class="itemIcon" src="/view/${item.hash}/icon.png" />
<img class="itemIcon" src="/view/${item.hashId}/icon.png" />
<div class="author">${item.author}</div>
<div class="title">${item.title}</div>
<div class="description">${item.description}</div>

View file

@ -6,43 +6,6 @@
<title>Oil Archive</title>
</head>
<body>
<div id="status_block">Your application is now running</div>
<div id="sidebar">
<h2>Learn more</h2>
Learn more about TurboGears and take part in its
development
<ul class="links">
<li><a href="http://www.turbogears.org">Official website</a></li>
<li><a href="http://docs.turbogears.org">Documentation</a></li>
<li><a href="http://trac.turbogears.org/turbogears/">Trac
(bugs/suggestions)</a></li>
<li><a href="http://groups.google.com/group/turbogears"> Mailing list</a> </li>
</ul>
<span py:replace="now">now</span>
</div>
<div id="getting_started">
<ol id="getting_started_steps">
<li class="getting_started">
<h3>Model</h3>
<p> <a href="http://docs.turbogears.org/1.0/GettingStarted/DefineDatabase">Design models</a> in the <span class="code">model.py</span>.<br/>
Edit <span class="code">dev.cfg</span> to <a href="http://docs.turbogears.org/1.0/GettingStarted/UseDatabase">use a different backend</a>, or start with a pre-configured SQLite database. <br/>
Use script <span class="code">tg-admin sql create</span> to create the database tables.</p>
</li>
<li class="getting_started">
<h3>View</h3>
<p> Edit <a href="http://docs.turbogears.org/1.0/GettingStarted/Kid">html-like templates</a> in the <span class="code">/templates</span> folder;<br/>
Put all <a href="http://docs.turbogears.org/1.0/StaticFiles">static contents</a> in the <span class="code">/static</span> folder. </p>
</li>
<li class="getting_started">
<h3>Controller</h3>
<p> Edit <span class="code"> controllers.py</span> and <a href="http://docs.turbogears.org/1.0/GettingStarted/CherryPy">build your
website structure</a> with the simplicity of Python objects. <br/>
TurboGears will automatically reload itself when you modify your project. </p>
</li>
</ol>
<div class="notice"> If you create something cool, please <a href="http://groups.google.com/group/turbogears">let people know</a>, and consider contributing something back to the <a href="http://groups.google.com/group/turbogears">community</a>.</div>
</div>
<!-- End of getting_started -->
Fill me
</body>
</html>