diff options
-rw-r--r-- | cfg/cherrypy.cfg | 21 | ||||
-rwxr-xr-x | img/blogmarks.png (renamed from css/img/blogmarks.png) | bin | 195 -> 195 bytes | |||
-rw-r--r-- | img/buzz.png (renamed from css/img/buzz.png) | bin | 791 -> 791 bytes | |||
-rw-r--r-- | img/check-news.png (renamed from css/img/check-news.png) | bin | 1383 -> 1383 bytes | |||
-rw-r--r-- | img/cross.png (renamed from css/img/cross.png) | bin | 655 -> 655 bytes | |||
-rwxr-xr-x | img/delicious.png (renamed from css/img/delicious.png) | bin | 266 -> 266 bytes | |||
-rw-r--r-- | img/diaspora.png (renamed from css/img/diaspora.png) | bin | 1179 -> 1179 bytes | |||
-rwxr-xr-x | img/digg.png (renamed from css/img/digg.png) | bin | 358 -> 358 bytes | |||
-rw-r--r-- | img/email-follow.png (renamed from css/img/email-follow.png) | bin | 4056 -> 4056 bytes | |||
-rw-r--r-- | img/favicon.png (renamed from css/img/favicon.png) | bin | 6879 -> 6879 bytes | |||
-rwxr-xr-x | img/feed-icon-28x28.png (renamed from css/img/feed-icon-28x28.png) | bin | 1737 -> 1737 bytes | |||
-rw-r--r-- | img/following-article.png (renamed from css/img/following-article.png) | bin | 989 -> 989 bytes | |||
-rw-r--r-- | img/heart-32x32.png (renamed from css/img/heart-32x32.png) | bin | 2084 -> 2084 bytes | |||
-rw-r--r-- | img/heart.png (renamed from css/img/heart.png) | bin | 634 -> 634 bytes | |||
-rw-r--r-- | img/heart_open.png (renamed from css/img/heart_open.png) | bin | 687 -> 687 bytes | |||
-rw-r--r-- | img/history.png (renamed from css/img/history.png) | bin | 3257 -> 3257 bytes | |||
-rw-r--r-- | img/identica.png (renamed from css/img/identica.png) | bin | 459 -> 459 bytes | |||
-rw-r--r-- | img/management.png (renamed from css/img/management.png) | bin | 2916 -> 2916 bytes | |||
-rw-r--r-- | img/mark-as-read.png (renamed from css/img/mark-as-read.png) | bin | 1762 -> 1762 bytes | |||
-rw-r--r-- | img/previous-article.png (renamed from css/img/previous-article.png) | bin | 997 -> 997 bytes | |||
-rwxr-xr-x | img/reddit.png (renamed from css/img/reddit.png) | bin | 525 -> 525 bytes | |||
-rwxr-xr-x | img/scoopeo.png (renamed from css/img/scoopeo.png) | bin | 295 -> 295 bytes | |||
-rw-r--r-- | img/tuxrss.png (renamed from css/img/tuxrss.png) | bin | 6879 -> 6879 bytes | |||
-rw-r--r-- | img/unread.png (renamed from css/img/unread.png) | bin | 1580 -> 1580 bytes | |||
-rwxr-xr-x | pyAggr3g470r.py | 120 |
25 files changed, 57 insertions, 84 deletions
diff --git a/cfg/cherrypy.cfg b/cfg/cherrypy.cfg new file mode 100644 index 00000000..7b53c1a2 --- /dev/null +++ b/cfg/cherrypy.cfg @@ -0,0 +1,21 @@ +[global] +log.error_file = "error.log" +log.access_file = "access.log" +server.environment = "production" +engine.autoreload_on = True +engine.autoreload_frequency = 5 + +[/] +tools.staticdir.root = os.getcwd() +tools.staticdir.on = True +tools.staticdir.dir = "." + +[/css] +tools.staticdir.on = True +tools.staticdir.dir = "css" +tools.staticdir.match = "(?i)^.+\.css$" + +[/images] +tools.staticdir.on = True +tools.staticdir.dir = "img" +tools.staticdir.match = "(?i)^.+\.png$"
\ No newline at end of file diff --git a/css/img/blogmarks.png b/img/blogmarks.png Binary files differindex 2464e5bb..2464e5bb 100755 --- a/css/img/blogmarks.png +++ b/img/blogmarks.png diff --git a/css/img/buzz.png b/img/buzz.png Binary files differindex e4bc1732..e4bc1732 100644 --- a/css/img/buzz.png +++ b/img/buzz.png diff --git a/css/img/check-news.png b/img/check-news.png Binary files differindex cce7df39..cce7df39 100644 --- a/css/img/check-news.png +++ b/img/check-news.png diff --git a/css/img/cross.png b/img/cross.png Binary files differindex 1514d51a..1514d51a 100644 --- a/css/img/cross.png +++ b/img/cross.png diff --git a/css/img/delicious.png b/img/delicious.png Binary files differindex a96f8c00..a96f8c00 100755 --- a/css/img/delicious.png +++ b/img/delicious.png diff --git a/css/img/diaspora.png b/img/diaspora.png Binary files differindex fdf8bb72..fdf8bb72 100644 --- a/css/img/diaspora.png +++ b/img/diaspora.png diff --git a/css/img/digg.png b/img/digg.png Binary files differindex 097c4600..097c4600 100755 --- a/css/img/digg.png +++ b/img/digg.png diff --git a/css/img/email-follow.png b/img/email-follow.png Binary files differindex 4505c610..4505c610 100644 --- a/css/img/email-follow.png +++ b/img/email-follow.png diff --git a/css/img/favicon.png b/img/favicon.png Binary files differindex d4d38473..d4d38473 100644 --- a/css/img/favicon.png +++ b/img/favicon.png diff --git a/css/img/feed-icon-28x28.png b/img/feed-icon-28x28.png Binary files differindex d64c669c..d64c669c 100755 --- a/css/img/feed-icon-28x28.png +++ b/img/feed-icon-28x28.png diff --git a/css/img/following-article.png b/img/following-article.png Binary files differindex 0e59e459..0e59e459 100644 --- a/css/img/following-article.png +++ b/img/following-article.png diff --git a/css/img/heart-32x32.png b/img/heart-32x32.png Binary files differindex 09b01cb5..09b01cb5 100644 --- a/css/img/heart-32x32.png +++ b/img/heart-32x32.png diff --git a/css/img/heart.png b/img/heart.png Binary files differindex f36f3cfd..f36f3cfd 100644 --- a/css/img/heart.png +++ b/img/heart.png diff --git a/css/img/heart_open.png b/img/heart_open.png Binary files differindex e1c6e027..e1c6e027 100644 --- a/css/img/heart_open.png +++ b/img/heart_open.png diff --git a/css/img/history.png b/img/history.png Binary files differindex 2a57cc17..2a57cc17 100644 --- a/css/img/history.png +++ b/img/history.png diff --git a/css/img/identica.png b/img/identica.png Binary files differindex 18b5bd2b..18b5bd2b 100644 --- a/css/img/identica.png +++ b/img/identica.png diff --git a/css/img/management.png b/img/management.png Binary files differindex 7bcbc384..7bcbc384 100644 --- a/css/img/management.png +++ b/img/management.png diff --git a/css/img/mark-as-read.png b/img/mark-as-read.png Binary files differindex ffc90910..ffc90910 100644 --- a/css/img/mark-as-read.png +++ b/img/mark-as-read.png diff --git a/css/img/previous-article.png b/img/previous-article.png Binary files differindex fcd9bfd8..fcd9bfd8 100644 --- a/css/img/previous-article.png +++ b/img/previous-article.png diff --git a/css/img/reddit.png b/img/reddit.png Binary files differindex 2d615f2a..2d615f2a 100755 --- a/css/img/reddit.png +++ b/img/reddit.png diff --git a/css/img/scoopeo.png b/img/scoopeo.png Binary files differindex 052c7dc8..052c7dc8 100755 --- a/css/img/scoopeo.png +++ b/img/scoopeo.png diff --git a/css/img/tuxrss.png b/img/tuxrss.png Binary files differindex d4d38473..d4d38473 100644 --- a/css/img/tuxrss.png +++ b/img/tuxrss.png diff --git a/css/img/unread.png b/img/unread.png Binary files differindex d3a641c7..d3a641c7 100644 --- a/css/img/unread.png +++ b/img/unread.png diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index 9d5c6c5d..3dc2b5d2 100755 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -22,7 +22,7 @@ __author__ = "Cedric Bonhomme" __version__ = "$Revision: 2.9 $" __date__ = "$Date: 2010/01/29 $" -__revision__ = "$Date: 2011/08/26 $" +__revision__ = "$Date: 2011/09/26 $" __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "GPLv3" @@ -63,61 +63,6 @@ def handle_error(): cherrypy.response.status = 500 cherrypy.response.body = [html] -bindhost = "0.0.0.0" -cherrypy.config.update({ 'server.socket_port': 12556, 'server.socket_host': bindhost}) -cherrypy.config.update({'error_page.404': error_page_404}) -_cp_config = {'request.error_response': handle_error} - -# static files -path = {'/css/style.css': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/style.css'}, \ - '/css/img/feed-icon-28x28.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/feed-icon-28x28.png'}, \ - '/css/img/tuxrss.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/tuxrss.png'}, \ - '/css/img/delicious.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/delicious.png'}, \ - '/css/img/digg.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/digg.png'}, \ - '/css/img/reddit.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/reddit.png'}, \ - '/css/img/scoopeo.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/scoopeo.png'}, \ - '/css/img/blogmarks.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/blogmarks.png'}, \ - '/css/img/buzz.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/buzz.png'}, \ - '/css/img/identica.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/identica.png'}, \ - '/css/img/diaspora.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/diaspora.png'}, \ - '/css/img/heart.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/heart.png'}, \ - '/css/img/heart_open.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/heart_open.png'}, \ - '/css/img/unread.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/unread.png'}, \ - '/css/img/heart-32x32.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/heart-32x32.png'}, \ - '/css/img/email-follow.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/email-follow.png'}, \ - '/css/img/cross.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/cross.png'}, \ - '/css/img/management.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/management.png'}, \ - '/css/img/history.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/history.png'}, \ - '/css/img/mark-as-read.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/mark-as-read.png'}, \ - '/css/img/check-news.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/check-news.png'}, \ - '/css/img/previous-article.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/previous-article.png'}, \ - '/css/img/following-article.png': {'tools.staticfile.on': True, \ - 'tools.staticfile.filename':utils.path+'/css/img/following-article.png'}, \ - '/var/qrcode': {'tools.staticdir.on': True, - 'tools.staticdir.dir': os.path.join(utils.path, './var/qrcode')}} - def htmlheader(nb_unread_articles=""): """ Return the header of the HTML page with the number of unread articles @@ -136,7 +81,7 @@ htmlfooter = '<p>This software is under GPLv3 license. You are welcome to copy, ' <a href="http://www.gnu.org/licenses/gpl-3.0.txt">GPLv3</a> license.</p></div>\n' + \ '</body>\n</html>' -htmlnav = '<body>\n<h1><div class="right innerlogo"><a href="/"><img src="/css/img/tuxrss.png"' + \ +htmlnav = '<body>\n<h1><div class="right innerlogo"><a href="/"><img src="/img/tuxrss.png"' + \ """ title="What's new today?"/></a>""" + \ '</div><a name="top"><a href="/">pyAggr3g470r - News aggregator</a></a></h1>\n<a' + \ ' href="http://bitbucket.org/cedricbonhomme/pyaggr3g470r/" rel="noreferrer" target="_blank">' + \ @@ -161,22 +106,22 @@ class Root: html += """<div class="left inner">\n""" if self.feeds: - html += '<a href="/management/"><img src="/css/img/management.png" title="Management" /></a>\n' - html += '<a href="/history/"><img src="/css/img/history.png" title="History" /></a>\n' + html += '<a href="/management/"><img src="/img/management.png" title="Management" /></a>\n' + html += '<a href="/history/"><img src="/img/history.png" title="History" /></a>\n' html += ' \n' - html += """<a href="/favorites/"><img src="/css/img/heart-32x32.png" title="Your favorites (%s)" /></a>\n""" % \ + html += """<a href="/favorites/"><img src="/img/heart-32x32.png" title="Your favorites (%s)" /></a>\n""" % \ (self.nb_favorites,) - html += """<a href="/notifications/"><img src="/css/img/email-follow.png" title="Active e-mail notifications (%s)" /></a>\n""" % \ + html += """<a href="/notifications/"><img src="/img/email-follow.png" title="Active e-mail notifications (%s)" /></a>\n""" % \ (self.nb_mail_notifications,) html += ' ' if self.nb_unread_articles != 0: - html += '<a href="/mark_as_read/"><img src="/css/img/mark-as-read.png" title="Mark articles as read" /></a>\n' - html += """<a href="/unread/"><img src="/css/img/unread.png" title="Unread article(s): %s" /></a>\n""" % \ + html += '<a href="/mark_as_read/"><img src="/img/mark-as-read.png" title="Mark articles as read" /></a>\n' + html += """<a href="/unread/"><img src="/img/unread.png" title="Unread article(s): %s" /></a>\n""" % \ (self.nb_unread_articles,) - html += '<a accesskey="F" href="/fetch/"><img src="/css/img/check-news.png" title="Check for news" /></a>\n' + html += '<a accesskey="F" href="/fetch/"><img src="/img/check-news.png" title="Check for news" /></a>\n' # The main page display all the feeds. for feed in self.feeds.values(): @@ -198,7 +143,7 @@ class Root: # display a heart for faved articles if article.like == "1": - like = """ <img src="/css/img/heart.png" title="I like this article!" />""" + like = """ <img src="/img/heart.png" title="I like this article!" />""" else: like = "" @@ -399,7 +344,7 @@ class Root: # display a heart for faved articles if article.like == "1": - like = """ <img src="/css/img/heart.png" title="I like this article!" />""" + like = """ <img src="/img/heart.png" title="I like this article!" />""" else: like = "" @@ -472,12 +417,12 @@ class Root: html += """<h1><i>%s</i> from <a href="/feed/%s">%s</a></h1>\n<br />\n""" % \ (article.article_title, feed_id, feed.feed_title) if article.like == "1": - html += """<a href="/like/0:%s:%s"><img src="/css/img/heart.png" title="I like this article!" /></a>""" % \ + html += """<a href="/like/0:%s:%s"><img src="/img/heart.png" title="I like this article!" /></a>""" % \ (feed_id, article.article_id) else: - html += """<a href="/like/1:%s:%s"><img src="/css/img/heart_open.png" title="Click if you like this article." /></a>""" % \ + html += """<a href="/like/1:%s:%s"><img src="/img/heart_open.png" title="Click if you like this article." /></a>""" % \ (feed_id, article.article_id) - html += """ <a href="/delete_article/%s:%s"><img src="/css/img/cross.png" title="Delete this article" /></a>""" % \ + html += """ <a href="/delete_article/%s:%s"><img src="/img/cross.png" title="Delete this article" /></a>""" % \ (feed_id, article.article_id) html += "<br /><br />" @@ -497,7 +442,7 @@ class Root: # Previous and following articles try: following = feed.articles.values()[feed.articles.keys().index(article_id) - 1] - html += """<div style="float:right;"><a href="/article/%s:%s" title="%s"><img src="/css/img/following-article.png" /></a></div>\n""" % \ + html += """<div style="float:right;"><a href="/article/%s:%s" title="%s"><img src="/img/following-article.png" /></a></div>\n""" % \ (feed_id, following.article_id, following.article_title) except: pass @@ -506,7 +451,7 @@ class Root: except: previous = feed.articles.values()[0] finally: - html += """<div style="float:left;"><a href="/article/%s:%s" title="%s"><img src="/css/img/previous-article.png" /></a></div>\n""" % \ + html += """<div style="float:left;"><a href="/article/%s:%s" title="%s"><img src="/img/previous-article.png" /></a></div>\n""" % \ (feed_id, previous.article_id, previous.article_title) html += "\n</div>\n" @@ -520,11 +465,11 @@ class Root: # Share this article: # on Diaspora html += """<a href="javascript:(function(){f='https://%s/bookmarklet?url=%s&title=%s&notes=%s&v=1&';a=function(){if(!window.open(f+'noui=1&jump=doclose','diasporav1','location=yes,links=no,scrollbars=no,toolbar=no,width=620,height=250'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()">\n\t - <img src="/css/img/diaspora.png" title="Share on Diaspora" /></a>\n """ % \ + <img src="/img/diaspora.png" title="Share on Diaspora" /></a>\n """ % \ (utils.DIASPORA_POD, article.article_link, article.article_title, "via pyAggr3g470r") # on Identi.ca - html += """\n\n<a href="http://identi.ca/index.php?action=newnotice&status_textarea=%s: %s" title="Share on Identi.ca" target="_blank"><img src="/css/img/identica.png" /></a> \n""" % \ + html += """\n\n<a href="http://identi.ca/index.php?action=newnotice&status_textarea=%s: %s" title="Share on Identi.ca" target="_blank"><img src="/img/identica.png" /></a> \n""" % \ (article.article_title, article.article_link) # Google +1 button @@ -534,32 +479,32 @@ class Root: # on Google Buzz html += """\n\n<a href="http://www.google.com/buzz/post?url=%s&message=%s" rel="noreferrer" target="_blank">\n\t - <img src="/css/img/buzz.png" title="Share on Google Buzz" /></a> """ % \ + <img src="/img/buzz.png" title="Share on Google Buzz" /></a> """ % \ (article.article_link, article.article_title) # on delicious html += """\n\n<a href="http://delicious.com/post?url=%s&title=%s" rel="noreferrer" target="_blank">\n\t - <img src="/css/img/delicious.png" title="Share on del.iciou.us" /></a> """ % \ + <img src="/img/delicious.png" title="Share on del.iciou.us" /></a> """ % \ (article.article_link, article.article_title) # on Digg html += """\n\n<a href="http://digg.com/submit?url=%s&title=%s" rel="noreferrer" target="_blank">\n\t - <img src="/css/img/digg.png" title="Share on Digg" /></a> """ % \ + <img src="/img/digg.png" title="Share on Digg" /></a> """ % \ (article.article_link, article.article_title) # on reddit html += """\n\n<a href="http://reddit.com/submit?url=%s&title=%s" rel="noreferrer" target="_blank">\n\t - <img src="/css/img/reddit.png" title="Share on reddit" /></a> """ % \ + <img src="/img/reddit.png" title="Share on reddit" /></a> """ % \ (article.article_link, article.article_title) # on Scoopeo html += """\n\n<a href="http://scoopeo.com/scoop/new?newurl=%s&title=%s" rel="noreferrer" target="_blank">\n\t - <img src="/css/img/scoopeo.png" title="Share on Scoopeo" /></a> """ % \ + <img src="/img/scoopeo.png" title="Share on Scoopeo" /></a> """ % \ (article.article_link, article.article_title) # on Blogmarks html += """\n\n<a href="http://blogmarks.net/my/new.php?url=%s&title=%s" rel="noreferrer" target="_blank">\n\t - <img src="/css/img/blogmarks.png" title="Share on Blogmarks" /></a> """ % \ + <img src="/img/blogmarks.png" title="Share on Blogmarks" /></a> """ % \ (article.article_link, article.article_title) # on Twitter html += """\n\n<a href="http://twitter.com/share" class="twitter-share-button" data-url="%s" data-text="%s" data-count="horizontal">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>\n""" % \ @@ -622,7 +567,7 @@ class Root: # display a heart for faved articles if article.like == "1": - like = """ <img src="/css/img/heart.png" title="I like this article!" />""" + like = """ <img src="/img/heart.png" title="I like this article!" />""" else: like = "" @@ -734,7 +679,7 @@ class Root: not_read_begin, not_read_end = "", "" if article.like == "1": - like = """ <img src="/css/img/heart.png" title="I like this article!" />""" + like = """ <img src="/img/heart.png" title="I like this article!" />""" else: like = "" @@ -880,7 +825,7 @@ class Root: not_read_begin, not_read_end = "", "" if article.like == "1": - like = """ <img src="/css/img/heart.png" title="I like this article!" />""" + like = """ <img src="/img/heart.png" title="I like this article!" />""" else: like = "" # Descrition for the CSS ToolTips @@ -1392,8 +1337,14 @@ if __name__ == '__main__': # Point of entry in execution mode print "Launching pyAggr3g470r..." LOCKER = threading.Lock() + root = Root() - root.favicon_ico = cherrypy.tools.staticfile.handler(filename=os.path.join(utils.path + "/css/img/favicon.png")) + root.favicon_ico = cherrypy.tools.staticfile.handler(filename=os.path.join(utils.path + "/img/favicon.png")) + bindhost = "0.0.0.0" + cherrypy.config.update({ 'server.socket_port': 12556, 'server.socket_host': bindhost}) + cherrypy.config.update({'error_page.404': error_page_404}) + _cp_config = {'request.error_response': handle_error} + if not os.path.isfile(utils.sqlite_base): # create the SQLite base if not exists print "Creating data base..." @@ -1411,4 +1362,5 @@ if __name__ == '__main__': thread_watch_base = threading.Thread(None, root.watch_base_classic, None, ()) thread_watch_base.setDaemon(True) thread_watch_base.start() - cherrypy.quickstart(root, config=path) + + cherrypy.quickstart(root, "/" ,config=utils.path + "/cfg/cherrypy.cfg")
\ No newline at end of file |