Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (45 sloc) 2.38 KB
from main import *
class GridView(CachedPage):
cacheName = "NewCategoryView"
def generateSection(self,pair):
caption = pair[0]
categorylabel = pair[1]
output = []
output.append(""" <div class="info-col">
<h2 id="%(category)s"> %(caption)s <font size="-1"> </h2>
<a class="image superman" href="">View Image</a>
<dl>""" % {'category': categorylabel, 'caption': caption})
for feed in Feed.gql("WHERE category = :1 ORDER BY listtitle", categorylabel):
output.append(""" <dt> %(title)s </dt>""" % { 'homepage': feed.homepage, 'title': feed.title })
for entry in Post.gql("WHERE service = :1 ORDER BY timestamp_created DESC LIMIT 7", feed.title):
output.append("""<dd><a href="%(link)s" title="%(title)s">%(title)s</a></dd>""" % {'link':, 'title': entry.title})
output.append(" ")
output.append("</dl> </div>")
return "".join(output)
def generatePage(self):
s = """
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<title>Categories Grid</title>
<link rel='stylesheet' type='text/css' href='content/infogrid-style.css' />
<script type='text/javascript' src=''></script>
<script type='text/javascript' src='content/infogrid.js'></script>
</head> <body> <div id="page-wrap"> """
thelist = [
['Pure mathematics', 'pure'],
['Applied mathematics','applied'],
['Teachers and Educators','teacher'],
['Comics, recreational mathematics and other fun','fun'],
['General scientific interest','general'],
['Journalistic Writers','journalism'],
['Journals, Publishers and similar feeds','journal'],
['Commercial blogs','commercial'],
return s + " ".join([self.generateSection(pair) for pair in thelist]) + """</div> </body> </html>"""