From 002172cad79cae18cf436ebab163ef5cfa8b216f Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Tue, 7 Dec 2010 17:34:09 +0100 Subject: Removed RSS generation. --- pyAggr3g470r.py | 63 ++++++++++++++------------------------------------------- 1 file changed, 15 insertions(+), 48 deletions(-) diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index a4a8efd8..1720f1d5 100755 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -286,7 +286,6 @@ class Root: html += "

Export articles

\n\n" html += """
\n\t\n
\n""" @@ -1037,37 +1036,15 @@ class Root: Export articles stored in the SQLite database in text (raw or HTML) files. """ - if export_method == "export_RSS": - content = """ - - - - pyAggr3g470r news - http:// - - pyAggr3g470r export - %s - %s - feeds.cgi - - """ % (time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()), \ - time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())) - for feed in self.feeds.values(): - if export_method != "export_RSS": - folder = utils.path + "/var/export/" + \ - utils.normalize_filename(feed.feed_title.strip().replace(':', '').lower()) - try: - os.makedirs(folder) - except OSError: - return self.error_page(utils.path + "var/export/"+" already exists.\nYou should delete this folder.") + # creates folder for each stream + folder = utils.path + "/var/export/" + \ + utils.normalize_filename(feed.feed_title.strip().replace(':', '').lower()) + try: + os.makedirs(folder) + except OSError: + # directories already exists (not a problem) + pass for article in feed.articles.values(): name = article.article_date.strip().replace(' ', '_') @@ -1094,26 +1071,14 @@ class Root: content += article.article_description content += '\n
Generated with pyAggr3g470r\n' - # Export all articles in RSS format - elif export_method == "export_RSS": - content += """\n%s\n%s\n""" % (article.article_title, article.article_link) - content += """%s\n""" % (str(article.article_date),) - content += """""" % (article.article_description,) - content += "\n" - # Export all articles in raw text elif export_method == "export_TXT": content = "Title: " + article.article_title + "\n\n\n" content += utils.clear_string(article.article_description) name = os.path.normpath(folder + "/" + name + ".txt") - if export_method != "export_RSS": - with open(name, "w") as f: - f.write(content) - - if export_method == "export_RSS": - content += "
\n
" - with open(os.path.normpath(utils.path + "/var/export/feeds.rss"), "w") as f: - f.write(content) + + with open(name, "w") as f: + f.write(content) return self.management() export.exposed = True @@ -1121,7 +1086,7 @@ class Root: def epub(self, param): """ - Export article(s) to epub. + Export an article to EPUB. """ try: from epub import ez_epub @@ -1140,13 +1105,15 @@ class Root: folder = utils.path + "/var/export/epub/" os.makedirs(folder) except OSError: - return self.error_page(utils.path + "var/export/epub/"+" already exists.\nYou should delete this folder.") + # directories already exists (not a problem) + pass section = ez_epub.Section() section.title = article.article_title.decode('utf-8') section.paragraphs = [utils.clear_string(article.article_description).decode('utf-8')] ez_epub.makeBook(article.article_title.decode('utf-8'), [feed.feed_title.decode('utf-8')], [section], \ os.path.normpath(folder + "article"), lang='en-US', cover=None) return self.article(param) + epub.exposed = True -- cgit