From: Michael Tremer Date: Sat, 28 Mar 2009 14:14:21 +0000 (+0100) Subject: Updated rss stuff. X-Git-Url: http://git.ipfire.org/?p=ipfire.org.git;a=commitdiff_plain;h=7e9fbd008b3ce6567f078bd3a0ad3bb5b31acf8a Updated rss stuff. Added news archieve site. Added rss feed. URL HAS CHANGED! Added old news massages. --- diff --git a/www/news.json b/www/news.json index 8c70648a..fc829e63 100644 --- a/www/news.json +++ b/www/news.json @@ -1,56 +1,152 @@ { - "1" : { "author" : "Michael Tremer", + "01" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : "IPFire 2.1 Final", + "date" : "2007-08-11", + "link" : "", + "content" : + { "en" : "

Today, we released the final version of IPFire 2.1.

", + "de" : "

Heute wurde die finale Version von IPFire 2.1 herausgegeben.

"}}, + + "02" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : { "en" : "IPFire's first rss feed", "de" : "IPFires RSS-Feed" }, + "date" : "2008-07-24", + "link" : "", + "content" : + { "en" : "

Now, the ipfire project has got it's own rss feed. This feed is for you, to keep you up on latest + security updates and releases..

", + "de" : "

Ab heute hat das IPFire-Projekt seinen eigenen RSS-Feed. Dieser soll die Möglichkeit bieten + auf dem Stand der Dinge zu bleiben.

"}}, + + "03" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : "Core Update 15", + "date" : "2008-07-24", + "link" : "", + "content" : + { "en" : "

Today, we released the core update number #15.
+ This is an important update because it will fix + the latest dns vulnerabilities.
+ Read this for more information.
+ Please install this update as soon as possible.

", + "de" : "

Heute wurde das Core Update #15 herausgegeben.
+ Dieses Update wird als kritisch eingestuft, da es die Sicherheitslücke des + DNS behebt.
+ Nähere Informationen dazu gibt es hier.
+ Bitte installieren Sie dieses Update möglichst schnell.

"}}, + + "04" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : "LUG Lünen", + "date" : "2008-07-30", + "link" : "http://www.linux-luenen.de/?q=node/15", + "content" : + { "en" : "

The linux user group from Lünen + released an article about ipfire.

", + "de" : "

Die Linux-User-Group aus Lünen hat einen Artikel + über IPFire auf ihrer Webseite veröffentlicht.

"}}, + + "05" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : "Core Update 16", + "date" : "2008-08-17", + "link" : "", + "content" : + { "en" : "

Today, we released the core update number #16.

", + "de" : "

Heute wurde das Core Update #16 herausgegeben.

"}}, + + "06" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : "IPFire 2.3 Beta 3", + "date" : "2008-08-20", + "link" : "http://forum.ipfire.org/index.php/topic,709.0.html", + "content" : + { "en" : "

Today, we released the beta version of IPFire 2.3.

", + "de" : "

Heute wurde die Beta-Version von IPFire 2.3 herausgegeben.

"}}, + + "07" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : { "en" : "Presentation of our project on kbarthel.de", + "de" : "Projektpräsentation auf kbarthel.de" }, + "date" : "2008-08-22", + "link" : "http://blog.kbarthel.de/?p=148", + "content" : + { "en" : "

Kim Barthel published on his blog a text about the project ipfire itself.

", + "de" : "

Kim Barthel veröffentlichte in seinem Blog einen umfassenden Bericht über IPFire.

"}}, + + "08" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : "IPFire 2.3 Beta 5", + "date" : "2008-10-13", + "link" : "http://forum.ipfire.org/index.php/topic,788.0.html", + "content" : + { "en" : "

Today, we released the beta version of IPFire 2.3.

", + "de" : "

Heute wurde die Beta-Version von IPFire 2.3 herausgegeben.

"}}, + + "09" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", "subject" : "IPFire 2.3 Final", "date" : "2008-11-08", + "link" : "", + "content" : + { "en" : "

Today, we released the final version of IPFire 2.3.

", + "de" : "

Heute wurde die finale Version von IPFire 2.3 herausgegeben.

"}}, + + "10" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : "Core Update 24", + "date" : "2008-12-12", + "link" : "http://forum.ipfire.org/index.php?topic=882.0", + "content" : + { "en" : "

Today, we released the core update number #24.

", + "de" : "

Heute wurde das Core Update #24 herausgegeben.

"}}, + + "11" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : "Core Update 25", + "date" : "2008-12-21", + "link" : "http://forum.ipfire.org/index.php?topic=951.0", + "content" : + { "en" : "

Today, we released the core update number #25.

", + "de" : "

Heute wurde das Core Update #25 herausgegeben.

"}}, + + "12" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : "Core Update 26", + "date" : "2009-02-11", + "link" : "http://forum.ipfire.org/index.php?topic=991.0", + "content" : + { "en" : "

Today, we released the core update number #26.

", + "de" : "

Heute wurde das Core Update #26 herausgegeben.

"}}, + + "13" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : "Core Update 27", + "date" : "2009-03-10", + "link" : "http://forum.ipfire.org/index.php?topic=1018.0", + "content" : + { "en" : "

Today, we released the core update number #27.

", + "de" : "

Heute wurde das Core Update #27 herausgegeben.

"}}, + + "14" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : "Hosting Partner", + "date" : "2009-03-28", + "link" : "http://wiki.ipfire.org/de/project/contribute", + "content" : + { "en" : "

We would like to welcome to our hosting partner ISP42 that + has given a server to the project for free.

", + "de" : "

Wir möchten unseren neuen Hosting-Partner ISP42 + willkommen heißen, der uns einen Server konstenfrei zu Verfügung stellt.

"}}, + + "15" : {"author" : "Michael Tremer", + "mail" : "michael.tremer@ipfire.org", + "subject" : { "en" : "rss feed url changed", "de" : "RSS-Feed-URL geändert" }, + "date" : "2009-03-28", + "link" : "", "content" : - { "en" : "

Dear Community!

-

This day, we released the final version of IPFire 2.3.

-

Major changes since the first version 2.1 in Oktober 2007:

- -

In addition, release 2.3 will change the following things:

- -

The IPFire Team

", - "de" : "Sehr geehrte Community!
-

Heute wurde die Final Version von IPFire 2.3 veröffentlicht.

-

Wesentliche Änderungen seit der ersten Version 2.1 im Oktober 2007:

- -

Mit der 2.3 wird sich zusätzlich folgendes ändern:

- -

Das IPFire-Team

" }} + { "en" : "

The url of our rss feed has changed. Please re-add it from the link in the sidebar.

", + "de" : "

Wir möchten darauf hinweisen, dass sich die URL des RSS-Feeds geändert hat. Es ist nötig + den Feed neu hinzuzufügen von dem Link in der Sidebar.

"}} } diff --git a/www/pages/news.rss/__init__.py b/www/pages/news.rss/__init__.py new file mode 100644 index 00000000..0e0a0ba4 --- /dev/null +++ b/www/pages/news.rss/__init__.py @@ -0,0 +1,44 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import time +from urllib import quote + +import web + +class Content(web.Content): + def __init__(self, name): + web.Content.__init__(self, name) + + self.news = web.News(15) + + def __call__(self, lang="en"): + s = "" + for item in self.news.items(): + for i in ("content", "subject",): + if type(item[i]) == type({}): + item[i] = item[i][lang] + item[i] = item[i].encode("utf-8") + item["lang"] = lang + item["date"] = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.strptime(item["date"], "%Y-%m-%d")) + item["guid"] = "http://www.ipfire.org/%s/news#%s" % (lang, quote(item["subject"])) + s += """ + %(subject)s + http://www.ipfire.org/%(lang)s/news + %(mail)s (%(author)s) + %(guid)s + %(date)s + + + + \n""" % item + return s + +class Sidebar(web.Sidebar): + def __init__(self, name): + web.Sidebar.__init__(self, name) + + def content(self, lang): + pass diff --git a/www/pages/static/index.xml b/www/pages/static/index.xml index 05eaafe2..7bbcc85c 100644 --- a/www/pages/static/index.xml +++ b/www/pages/static/index.xml @@ -114,14 +114,13 @@ RSS feed]]> IPFire - News + IPFire - News
- news archive]]>
+ news archive]]> IPFire - News + IPFire - News
- News-Archiv - ]]>
+ News-Archiv]]> diff --git a/www/pages/static/news.xml b/www/pages/static/news.xml new file mode 100644 index 00000000..fe2fa5fa --- /dev/null +++ b/www/pages/static/news.xml @@ -0,0 +1,35 @@ + + + + News + + + + IPFire News Archive + IPFire-News-Archiv + + + Additionally, you may subscribe to our + rss feed. + ]]> + + Weiterhin gibt es einen + RSS-Feed, der sich abbonieren + lässt. + ]]> + + + + + + + + + diff --git a/www/rss.inc b/www/rss.inc new file mode 100644 index 00000000..3c899b5a --- /dev/null +++ b/www/rss.inc @@ -0,0 +1,12 @@ + + + + IPFire.org - News + http://www.ipfire.org/ + IPFire News Feed + %(lang)s + IPFire-Team + Thu, 8 Nov 2007 00:00:00 +0200 + %(content)s + + diff --git a/www/web/__init__.py b/www/web/__init__.py index 00758083..32fd65d9 100644 --- a/www/web/__init__.py +++ b/www/web/__init__.py @@ -25,7 +25,7 @@ class Json: f = open(file) data = f.read() data = data.replace('\n', '') # Remove all \n - data = data.replace('\t', '') # Remove all \t + data = data.replace('\t', ' ') # Remove all \t self.json = json.loads(data) f.close() @@ -43,6 +43,7 @@ class Page(Data): def __init__(self, title, content, sidebar=None): self.output = "" + self.title = title self.langs = Languages() self.data = {"server": os.environ["SERVER_NAME"].replace("ipfire", "ipfire"), "title" : "%s - %s" % (os.environ["SERVER_NAME"], title,), @@ -58,22 +59,28 @@ class Page(Data): self.data["sidebar"] = sidebar(self.langs.current) def __call__(self): + type = "text/html" try: - self.include("template.inc") + if self.title.endswith(".rss"): + self.include("rss.inc") + type = "application/rss+xml" + else: + self.include("template.inc") code = 200 except WebError: code = 500 - h = HTTPResponse(code) + h = HTTPResponse(code, type=type) h.execute(self.output) class News(Json): def __init__(self, limit=3): Json.__init__(self, "news.json") - self.news = self.json.values() + self.news = [] + for key in sorted(self.json.keys()): + self.news.insert(0, self.json[key]) if limit: self.news = self.news[:limit] - self.news.reverse() def html(self, lang="en"): s = "" @@ -81,8 +88,13 @@ class News(Json): for i in ("content", "subject",): if type(item[i]) == type({}): item[i] = item[i][lang] - b = Box(item["date"] + " - " + item["subject"], "by %s" % item["author"]) + b = Box(item["subject"], "%(date)s - by %(author)s" % item) b.w(item["content"]) + if item["link"]: + if lang == "en": + b.w("""

Read more.

""" % item) + elif lang == "de": + b.w("""

Mehr Informationen.

""" % item) s += b() return s @@ -96,6 +108,9 @@ class News(Json): headlines.append((item["subject"],)) return headlines + def items(self): + return self.news + class Menu(Json): def __init__(self, lang):