#! /usr/bin/env python
#-*- coding: utf-8 -*-
# pyAggr3g470r - A Web based news aggregator.
# Copyright (C) 2010 Cédric Bonhomme - http://cedricbonhomme.org/
#
# For more information : http://bitbucket.org/cedricbonhomme/pyaggr3g470r/
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 2.9 $"
__date__ = "$Date: 2010/01/29 $"
__revision__ = "$Date: 2011/09/26 $"
__copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "GPLv3"
#
# This file contains the "Root" class which describes
# all pages of pyAggr3g470r. These pages are:
# - main page;
# - management;
# - history;
# - history;
# - favorites;
# - notifications;
# - unread;
# - feed summary.
#
import os
import re
import time
import sqlite3
import cherrypy
import calendar
import threading
from collections import Counter
import datetime
import utils
import feedgetter
import PyQRNative
def error_page_404(status, message, traceback, version):
"""
Display an error if the page does not exist.
"""
html = htmlheader()
html += htmlnav
html += "
Error %s - This page does not exist." % status
html += "\n
\n" + htmlfooter
return html
def handle_error():
"""
Handle different type of errors.
"""
html = htmlheader()
html += htmlnav
html += "
Sorry, an error occured"
html += "\n\n" + htmlfooter
cherrypy.response.status = 500
cherrypy.response.body = [html]
def htmlheader(nb_unread_articles=""):
"""
Return the header of the HTML page with the number of unread articles
in the 'title' HTML tag..
"""
return '\n' + \
'' + \
'\n\t'+ nb_unread_articles +'pyAggr3g470r - News aggregator\n' + \
'\t' + \
'\n\t\n' + \
'\n\t\n' + \
'\n'
htmlfooter = '
This software is under GPLv3 license. You are welcome to copy, modify or' + \
' redistribute the source code according to the' + \
' GPLv3 license.