[Mpuls-commits] r1397 - wasko/branches/2.0/waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 9 15:56:17 CET 2010


Author: torsten
Date: 2010-02-09 15:56:16 +0100 (Tue, 09 Feb 2010)
New Revision: 1397

Removed:
   wasko/branches/2.0/waskaweb/model/agencysettings.py
Log:
* waskaweb/model/agencysettings.py: Deleted.


Deleted: wasko/branches/2.0/waskaweb/model/agencysettings.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/agencysettings.py	2010-02-09 14:54:52 UTC (rev 1396)
+++ wasko/branches/2.0/waskaweb/model/agencysettings.py	2010-02-09 14:56:16 UTC (rev 1397)
@@ -1,129 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2007, 2008 Intevation GmbH, Germany, <info at intevation.de>
-#
-# 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
-# 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
-# European Social Fund resources.
-#
-# Authors:
-# Torsten <irlaender at intevation.de>
-#
-
-import sys
-import traceback
-
-import psycopg2.extras
-
-from mpulsweb.lib.config import get_path
-from mpulsweb.lib.db import db
-from mpulsweb.lib.helpers import ensure_unicode
-
-
-FETCH_SETTINGS_SQL = """SELECT bez, wert from ka_konfiguration_tbl_view"""
-STORE_SETTINGS_SQL = """\
-UPDATE ka_konfiguration_tbl_view SET wert = %(wert)s WHERE bez = %(bez)s"""
-
-
-class Agency:
-
-    def __init__(self):
-        self.conf = {}
-        self._fetchData()
-
-    def _fetchData(self):
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
-            cur.execute(FETCH_SETTINGS_SQL)
-            rows = cur.fetchall()
-            for row in rows:
-                self.conf[row['bez']] = ensure_unicode(row['wert'])
-        finally:
-            db.recycleConnection(conn, cur)
-
-    def store(self, formdata):
-        conn = None
-        try:
-            try:
-                conn = db.getConnection()
-                for key, value in formdata.iteritems():
-                    # TODO: Its not necessary to fetch a new cursor each time.
-                    cur = None
-                    try:
-                        cur = conn.cursor()
-                        cur.execute(STORE_SETTINGS_SQL,
-                                    {'bez': key, 'wert': value})
-                        conn.commit()
-                    finally:
-                        if cur:
-                            try:
-                                cur.close()
-                            except:
-                                pass
-            finally:
-                db.recycleConnection(conn)
-        except:
-            traceback.print_exc(file=sys.stderr)
-
-    def isAnonTransfer(self):
-        anon = self.conf.get('anon_transfer', '').strip().lower()
-        return anon == 'on' or anon == '1'
-
-    def getFKZ(self):
-        return self.conf.get('fkz', u'')
-
-    def getName(self):
-        return self.conf.get('ka_name', u'')
-
-    def getMaxSavetime(self):
-        return self.conf.get('max_speicherdauer', u'')
-
-    def _loadDefaultStatement(self, filename):
-        # XXX: Dead ugly!
-        f = None
-        try:
-            f = open(filename, "r")
-            statement = f.read()
-        finally:
-            if f:
-                try:
-                    f.close()
-                except:
-                    pass
-        return unicode(statement, 'utf-8')
-
-    def getPrivacyStatement(self):
-        form = self.conf.get('ee_formular', '')
-        if len(form) > 0:
-            return form
-        return self._loadDefaultStatement(get_path('formed',
-                                                   'privacy_statement.html'))
-
-    def getDiscretionStatement(self):
-        form = self.conf.get('ud_formular', '')
-        if len(form) > 0:
-            return form
-        return self._loadDefaultStatement(get_path('formed',
-                                                   'discretion_statement.html'))
-
-# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8:



More information about the Mpuls-commits mailing list