[Mpuls-commits] r1576 - in wasko/branches/2.0: . mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Feb 15 19:49:45 CET 2010
Author: bh
Date: 2010-02-15 19:49:44 +0100 (Mon, 15 Feb 2010)
New Revision: 1576
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/mpulsweb/model/news.py
Log:
* mpulsweb/model/news.py: Fix formatting.
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-02-15 18:45:10 UTC (rev 1575)
+++ wasko/branches/2.0/ChangeLog 2010-02-15 18:49:44 UTC (rev 1576)
@@ -1,5 +1,9 @@
2010-02-15 Bernhard Herzog <bh at intevation.de>
+ * mpulsweb/model/news.py: Fix formatting.
+
+2010-02-15 Bernhard Herzog <bh at intevation.de>
+
* mpulsweb/model/document.py: Fix formatting.
2010-02-15 Bernhard Herzog <bh at intevation.de>
Modified: wasko/branches/2.0/mpulsweb/model/news.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/news.py 2010-02-15 18:45:10 UTC (rev 1575)
+++ wasko/branches/2.0/mpulsweb/model/news.py 2010-02-15 18:49:44 UTC (rev 1576)
@@ -1,49 +1,65 @@
#-*- coding: utf-8 -*-
#
# Copyright 2007, 2008 Intevation GmbH, Germany, <info at intevation.de>
-#
-# This file is part of mpuls WASKA (CoMPUter-based case fiLeS -
+#
+# This file is part of mpuls WASKA (CoMPUter-based case fiLeS -
# Web-Anwendungs-Server fuer Kompetenzagenturen).
-#
+#
# mpuls WASKA is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
-#
+#
# mpuls WASKA 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 Affero General Public
# License for more details.
-#
+#
# You should have received a copy of the GNU Affero General Public
# License along with mpuls WASKA. If not, see <http://www.gnu.org/licenses/>.
-#
-# mpuls WASKA has been developed on behalf of the
+#
+# mpuls WASKA has been developed on behalf of the
# Projekttraeger im Deutschen Zentrum fuer Luft- und Raumfahrt e.V. (PT-DLR)
# within the programme Kompetenzagenturen (Durchfuehrungsphase) funded by
-# the Bundesministerium fuer Familie, Senioren, Frauen und Jugend and
+# the Bundesministerium fuer Familie, Senioren, Frauen und Jugend and
# European Social Fund resources.
#
# Authors:
# Torsten Irländer <torsten.irlaender at intevation.de>
#
-import psycopg2.extras
+
+import sys
import os
import traceback
-import sys
+
+import psycopg2.extras
+
from mpulsweb.lib.db import db
-FETCH_ALL_NEWS = """SELECT id, datum, titel, nachricht, art_beschreibung FROM ka_nachrichten_tbl_view WHERE id NOT IN (SELECT nachrichten_id from nm_benutzer_nachrichten_tbl_view WHERE benutzer_id = %(user_id)s) ORDER BY datum DESC"""
+FETCH_ALL_NEWS = """\
+SELECT id, datum, titel, nachricht, art_beschreibung
+FROM ka_nachrichten_tbl_view
+WHERE id NOT IN (SELECT nachrichten_id
+ FROM nm_benutzer_nachrichten_tbl_view
+ WHERE benutzer_id = %(user_id)s)
+ORDER BY datum DESC
+"""
+
+
class NewsFactory:
+
def __init__(self):
pass
def createByData(self, **attr):
return News(**attr)
+
class NewsList:
- '''List of news objects for the given user'''
+
+ """List of news objects for the given user"""
+
def __init__(self, user):
self.list = []
factory = NewsFactory()
@@ -52,19 +68,23 @@
cur = conn.cursor()
cur.execute(FETCH_ALL_NEWS, {'user_id': user.id})
for row in cur.fetchall():
- self.list.append(factory.createByData(id=row[0], date=row[1], title=row[2], text=row[3], type=row[4]))
+ self.list.append(factory.createByData(id=row[0], date=row[1],
+ title=row[2], text=row[3],
+ type=row[4]))
finally:
db.recycleConnection(conn, cur)
def getList(self):
return self.list
+
class News:
+
def __init__(self, id=None, date=None, title=None, text=None, type=None):
- self.id = id
- self.date = date
+ self.id = id
+ self.date = date
self.title = title
- self.text = text
- self.type = type
+ self.text = text
+ self.type = type
# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8:
More information about the Mpuls-commits
mailing list