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

View file

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

View file

@ -25,7 +25,7 @@ def icon(item):
icon_root = join(cache_root, 'icon') icon_root = join(cache_root, 'icon')
if not exists(icon_root): if not exists(icon_root):
os.makedirs(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): if exists(icon):
data = laod_file(icon) data = laod_file(icon)
else: 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

@ -35,14 +35,7 @@
<div py:if="tg_flash" class="flash" py:content="tg_flash"></div> <div py:if="tg_flash" class="flash" py:content="tg_flash"></div>
<div py:replace="[item.text]+item[:]"/> <div py:replace="[item.text]+item[:]"/>
<!-- End of main_content -->
</div> </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>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<body> <body>
<div class="item"> <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="author">${item.author}</div>
<div class="title">${item.title}</div> <div class="title">${item.title}</div>
<div class="description">${item.description}</div> <div class="description">${item.description}</div>

View file

@ -6,43 +6,6 @@
<title>Oil Archive</title> <title>Oil Archive</title>
</head> </head>
<body> <body>
Fill me
<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 -->
</body> </body>
</html> </html>