From 0fc25218ad337c208024b325ec4c0c5656ee893e Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Sun, 22 Apr 2012 23:05:30 +0200 Subject: Added conf.py which is responsible of the load of the configuration. --- source/pyAggr3g470r.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'source/pyAggr3g470r.py') diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 7c4c8fde..a9434fba 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -46,6 +46,7 @@ import calendar from collections import Counter import datetime +import conf import utils import export import mongodb @@ -108,7 +109,7 @@ class Root: def __init__(self): """ """ - self.mongo = mongodb.Articles(utils.MONGODB_ADDRESS, utils.MONGODB_PORT) + self.mongo = mongodb.Articles(conf.MONGODB_ADDRESS, conf.MONGODB_PORT) def index(self): """ @@ -506,7 +507,7 @@ class Root: # on Diaspora html += """\n\t \n""" % \ - (utils.DIASPORA_POD, article["article_link"], article["article_title"], "via pyAggr3g470r") + (conf.DIASPORA_POD, article["article_link"], article["article_title"], "via pyAggr3g470r") # on Identi.ca html += """\n\n""" % \ @@ -578,7 +579,7 @@ class Root: " unread article" + (self.mongo.nb_unread_articles(feed_id) == 1 and [""] or ["s"])[0]])[0] + ".

" if feed["mail"] == True: html += """

You are receiving articles from this feed to the address: %s. """ % \ - (utils.mail_to, utils.mail_to) + (conf.mail_to, conf.mail_to) html += """Stop receiving articles from this feed.

""" % \ (feed_id, ) @@ -991,7 +992,7 @@ class Root: else: html += "

No active notifications.

\n" html += """

Notifications are sent to: %s

""" % \ - (utils.mail_to, utils.mail_to) + (conf.mail_to, conf.mail_to) html += "\n
\n" + htmlfooter return html @@ -1217,7 +1218,7 @@ class Root: except: self.error_page("This article do not exists.") try: - folder = utils.path + "/var/export/epub/" + folder = conf.path + "/var/export/epub/" os.makedirs(folder) except OSError: # directories already exists (not a problem) @@ -1237,9 +1238,9 @@ if __name__ == '__main__': print "Launching pyAggr3g470r..." root = Root() - root.favicon_ico = cherrypy.tools.staticfile.handler(filename=os.path.join(utils.path + "/img/favicon.png")) + root.favicon_ico = cherrypy.tools.staticfile.handler(filename=os.path.join(conf.path + "/img/favicon.png")) cherrypy.config.update({ 'server.socket_port': 12556, 'server.socket_host': "0.0.0.0"}) cherrypy.config.update({'error_page.404': error_page_404}) _cp_config = {'request.error_response': handle_error} - cherrypy.quickstart(root, "/" ,config=utils.path + "/cfg/cherrypy.cfg") + cherrypy.quickstart(root, "/" ,config=conf.path + "/cfg/cherrypy.cfg") -- cgit