Permalink
Browse files

forgotten files added

  • Loading branch information...
Fred
Fred committed Aug 9, 2011
1 parent 289d3ce commit cdb4de1ace86a6d201aa705ff21baaa452ee7bb8
Showing with 1,191 additions and 0 deletions.
  1. +71 −0 categoryview.py
  2. +29 −0 dataexport.py
  3. +52 −0 dateview.py
  4. +52 −0 dateviewhisartvis.py
  5. +52 −0 dateviewresearch.py
  6. +52 −0 dateviewteacher.py
  7. +139 −0 feedhandler.py
  8. BIN feedparser.pyc
  9. +49 −0 grid.py
  10. +31 −0 planetmo.py
  11. +78 −0 planettag.py
  12. +354 −0 sanitize.py
  13. +114 −0 statsview.py
  14. +90 −0 temp_global.py
  15. +28 −0 weeklypicks.py
View
@@ -0,0 +1,71 @@
+from main import *
+
+class CategoryView(TemplatePage):
+ cacheName = "CategoryView"
+ def generateSection(self,pair):
+ caption = pair[0]
+ categorylabel = pair[1]
+ output = []
+ output.append("""
+ <h2 id="%(category)s"> %(caption)s <a href="#"> (Back to top) </a> </h2>
+ <ul class="feedbox-list">
+ """ % {'category': categorylabel, 'caption': caption})
+ for feed in Feed.gql("WHERE category = :1 ORDER BY listtitle", categorylabel):
+ output.append("""
+ <li>
+ <div class="feedbox">
+ <h3> <a href="%(homepage)s">%(title)s </a> </h3>
+ <ul>
+ """ % { '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("""
+ <li><a href="%(link)s" title="%(title)s">%(title)s</a></li>
+ """ % {'link': entry.link, 'title': entry.title})
+ output.append("""
+ </ul> </div> </li>
+ """)
+ output.append("""
+ </ul>
+ """)
+ return "".join(output)
+ def generateContent(self):
+ s = """
+ <p> The categories represent what we see as roughly the primary focus of each blog -- this supplements <a href="/planettag">PlanetTAG</a>.</p>
+ <div class="tocbox">
+ <ul>
+ <li> <a href="#pure">Pure</a></li>
+ <li> <a href="#applied">Applied</a></li>
+ <li> <a href="#teacher">Teachers</a></li>
+ <li> <a href="#visual">Visualization</a></li>
+ <li> <a href="#history">History</a></li>
+ <li> <a href="#art">Art</a></li>
+ <li> <a href="#fun">Fun</a></li>
+ <li> <a href="#general">General</a></li>
+ <li> <a href="#journalism">Journalism</a></li>
+ <li> <a href="#journal">Journals</a></li>
+ <li> <a href="#commercial">Commercial</a></li>
+ <li> <a href="#community">Communities</a></li>
+ <li> <a href="#institution">Institutions</a></li>
+ <li> <a href="#news">News</a></li>
+ <li> <a href="#carnivals">Carnivals</a></li>
+ </ul>
+ </div>
+ """
+ thelist = [
+ ['Pure mathematics', 'pure'],
+ ['Applied mathematics','applied'],
+ ['Teachers and Educators','teacher'],
+ ['Visualizations','visual'],
+ ['History','history'],
+ ['Art','art'],
+ ['Comics, recreational mathematics and other fun','fun'],
+ ['General scientific interest','general'],
+ ['Journalistic Writers','journalism'],
+ ['Journals, Publishers and similar feeds','journal'],
+ ['Commercial blogs','commercial'],
+ ['Communities','community'],
+ ['Institutions','institution'],
+ ['News','news'],
+ ['Carnivals','carnival'],
+ ]
+ return s + " ".join([self.generateSection(pair) for pair in thelist])
View
@@ -0,0 +1,29 @@
+from main import *
+
+class CsvView(CachedPage):
+ cacheName = "CsvView"
+ selfurl = "database.csv"
+ # self.response.headers['Content-Type'] = 'text/csv'
+ def generatePage(self):
+ output = []
+ output.append( """title, homepage, person, category, posts_url, comments_url, priority, favicon, listtitle, language""")
+ for feed in Feed.gql("WHERE category IN :1 ORDER BY listtitle", ['pure', 'applied', 'teacher', 'history', 'visual','art','journalism','fun','journal', 'general','institution','commercial','community']):
+ output.append(""" "%(title)s",%(homepage)s,"%(person)s",%(category)s,%(url)s,%(comments)s,1,%(favicon)s, "%(listtitle)s",%(language)s \n""" % {'title': feed.title,'homepage': feed.homepage, 'person': feed.person , 'category':feed.category, 'url': feed.posts_url,'comments': feed.comments_url, 'favicon': feed.favicon, 'listtitle': feed.listtitle, 'language' : feed.language } )
+ return "".join(output)
+
+class OPMLView(CachedPage):
+ cacheName = "OPMLView"
+ selfurl = "database-opml.xml"
+ def generatePage(self):
+ output = []
+ output.append("""<?xml version="1.0" encoding="UTF-8"?> <opml version="1.0">
+ <head>
+ <title>Mathblogging.org Database export to OPML</title>
+ </head>
+ <body><outline title="Mathblogging.org" text="Mathblogging.org">""")
+ for feed in Feed.gql("WHERE category IN :1 ORDER BY listtitle", ['pure', 'applied', 'teacher', 'history', 'visual','art','journalism','fun','journal', 'general','institution','commercial','community']):
+ output.append("""
+ <outline text="%(title)s" title="%(title)s" type="rss"
+ xmlUrl="%(url)s" htmlUrl="%(homepage)s"/>""" % {'title': feed.title,'homepage': feed.homepage, 'person': feed.person , 'category':feed.category, 'url': feed.posts_url,'comments': feed.comments_url, 'favicon': feed.favicon, 'listtitle': feed.listtitle, 'language' : feed.language } )
+ output.append("""</outline></body></opml>""")
+ return "".join(output)
View
@@ -0,0 +1,52 @@
+from main import *
+
+class DateView(TemplatePage):
+ cacheName = "DateView"
+ def generateContent(self):
+ s = """<div class="tocbox">
+ <ul>
+ <li><a href="/bydate" title="Recent posts">All</a> </li>
+ <li><a href="/byresearchdate" title="Recent posts in Research">Researchers</a>
+ </li>
+ <li><a href="/byartvishisdate" title="Recent posts in Art,Visual,History">Art/Vis/His</a>
+ </li>
+ <li><a href="/byteacherdate" title="Recent posts from Teachers">Teachers</a>
+ </li>
+ </ul>
+</div>
+ <h2> The latests posts </h2>
+<table class="bydate">
+ <thead>
+ <tr>
+ <th align="left" class="datecolumn">
+ Date
+ </th>
+ <th align="left" class="blogcolumn">
+ Blog
+ </th>
+ <th align="left" class="postcolumn">
+ Post
+ </th>
+ </tr>
+ </thead>
+ <tbody>"""
+ for post in Post.gql("WHERE category IN :1 ORDER BY timestamp_created DESC LIMIT 150", ['history','fun','general','commercial','art','visual','pure','applied','teacher','journalism']):
+ s = s + """
+ <tr>
+ <td valign="bottom" class="datecolumn">
+ <div>
+ %(time)s
+ </div>
+ </td>
+ <td valign="bottom" class="blogcolumn">
+ <div>
+ <a href="%(homepage)s" title="%(service)s">%(service)s</a>
+ </div>
+ </td>
+ <td valign="bottom" class="postcolumn">
+ <div>
+ <a href="%(link)s" title="%(title)s">%(title)s</a>
+ </div>
+ </td>
+ </tr>""" % {'time': post.printShortTime_created(), 'homepage': post.homepage, 'service': post.service, 'title': post.title, 'link': post.link }
+ return s + "</tbody></table>"
View
@@ -0,0 +1,52 @@
+from main import *
+
+class DateViewHisArtVis(TemplatePage):
+ cacheName = "DateViewHisArtVis"
+ def generateContent(self):
+ s = """<div class="tocbox">
+ <ul>
+ <li><a href="/bydate" title="Recent posts">All</a> </li>
+ <li><a href="/byresearchdate" title="Recent posts in Research">Researchers</a>
+ </li>
+ <li><a href="/byartvishisdate" title="Recent posts in Art,Visual,History">Art/Vis/His</a>
+ </li>
+ <li><a href="/byteacherdate" title="Recent posts from Teachers">Teachers</a>
+ </li>
+ </ul>
+</div>
+ <h2> The latests posts 'Art, Visual, History' </h2>
+<table class="bydate">
+ <thead>
+ <tr>
+ <th align="left" class="datecolumn">
+ Date
+ </th>
+ <th align="left" class="blogcolumn">
+ Blog
+ </th>
+ <th align="left" class="postcolumn">
+ Post
+ </th>
+ </tr>
+ </thead>
+ <tbody>"""
+ for post in Post.gql("WHERE category IN :1 ORDER BY timestamp_created DESC LIMIT 150", ['history','art','visual']):
+ s = s + """
+ <tr>
+ <td valign="bottom" class="datecolumn">
+ <div>
+ %(time)s
+ </div>
+ </td>
+ <td valign="bottom" class="blogcolumn">
+ <div>
+ <a href="%(homepage)s" title="%(service)s">%(service)s</a>
+ </div>
+ </td>
+ <td valign="bottom" class="postcolumn">
+ <div>
+ <a href="%(link)s" title="%(title)s">%(title)s</a>
+ </div>
+ </td>
+ </tr>""" % {'time': post.printShortTime_created(), 'homepage': post.homepage, 'service': post.service, 'title': post.title, 'link': post.link }
+ return s + "</tbody></table>"
View
@@ -0,0 +1,52 @@
+from main import *
+
+class DateViewResearch(TemplatePage):
+ cacheName = "DateViewResearch"
+ def generateContent(self):
+ s = """<div class="tocbox">
+ <ul>
+ <li><a href="/bydate" title="Recent posts">All</a> </li>
+ <li><a href="/byresearchdate" title="Recent posts in Research">Researchers</a>
+ </li>
+ <li><a href="/byartvishisdate" title="Recent posts in Art,Visual,History">Art/Vis/His</a>
+ </li>
+ <li><a href="/byteacherdate" title="Recent posts from Teachers">Teachers</a>
+ </li>
+ </ul>
+</div>
+ <h2> The latests posts 'Pure, Applied' </h2>
+<table class="bydate">
+ <thead>
+ <tr>
+ <th align="left" class="datecolumn">
+ Date
+ </th>
+ <th align="left" class="blogcolumn">
+ Blog
+ </th>
+ <th align="left" class="postcolumn">
+ Post
+ </th>
+ </tr>
+ </thead>
+ <tbody>"""
+ for post in Post.gql("WHERE category IN :1 ORDER BY timestamp_created DESC LIMIT 150", ['pure','applied']):
+ s = s + """
+ <tr>
+ <td valign="bottom" class="datecolumn">
+ <div>
+ %(time)s
+ </div>
+ </td>
+ <td valign="bottom" class="blogcolumn">
+ <div>
+ <a href="%(homepage)s" title="%(service)s">%(service)s</a>
+ </div>
+ </td>
+ <td valign="bottom" class="postcolumn">
+ <div>
+ <a href="%(link)s" title="%(title)s">%(title)s</a>
+ </div>
+ </td>
+ </tr>""" % {'time': post.printShortTime_created(), 'homepage': post.homepage, 'service': post.service, 'title': post.title, 'link': post.link }
+ return s + "</tbody></table>"
View
@@ -0,0 +1,52 @@
+from main import *
+
+class DateViewTeacher(TemplatePage):
+ cacheName = "DateViewTeacher"
+ def generateContent(self):
+ s = """<div class="tocbox">
+ <ul>
+ <li><a href="/bydate" title="Recent posts">All</a> </li>
+ <li><a href="/byresearchdate" title="Recent posts in Research">Researchers</a>
+ </li>
+ <li><a href="/byartvishisdate" title="Recent posts in Art,Visual,History">Art/Vis/His</a>
+ </li>
+ <li><a href="/byteacherdate" title="Recent posts from Teachers">Teachers</a>
+ </li>
+ </ul>
+</div>
+<h2> The latests posts 'Teachers, Educators' </h2>
+<table class="bydate">
+ <thead>
+ <tr>
+ <th align="left" class="datecolumn">
+ Date
+ </th>
+ <th align="left" class="blogcolumn">
+ Blog
+ </th>
+ <th align="left" class="postcolumn">
+ Post
+ </th>
+ </tr>
+ </thead>
+ <tbody>"""
+ for post in Post.gql("WHERE category IN :1 ORDER BY timestamp_created DESC LIMIT 150", ['teacher']):
+ s = s + """
+ <tr>
+ <td valign="bottom" class="datecolumn">
+ <div>
+ %(time)s
+ </div>
+ </td>
+ <td valign="bottom" class="blogcolumn">
+ <div>
+ <a href="%(homepage)s" title="%(service)s">%(service)s</a>
+ </div>
+ </td>
+ <td valign="bottom" class="postcolumn">
+ <div>
+ <a href="%(link)s" title="%(title)s">%(title)s</a>
+ </div>
+ </td>
+ </tr>""" % {'time': post.printShortTime_created(), 'homepage': post.homepage, 'service': post.service, 'title': post.title, 'link': post.link }
+ return s + "</tbody></table>"
Oops, something went wrong.

0 comments on commit cdb4de1

Please sign in to comment.