[Mpuls-commits] r2131 - in wasko/branches/2.0: jmdweb/model mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Mar 25 08:57:03 CET 2010


Author: torsten
Date: 2010-03-25 08:57:03 +0100 (Thu, 25 Mar 2010)
New Revision: 2131

Added:
   wasko/branches/2.0/mpulsweb/model/statement.py
Removed:
   wasko/branches/2.0/jmdweb/model/statement.py
Modified:
   wasko/branches/2.0/jmdweb/model/case.py
Log:
Moved statement model into mpulsweb


Modified: wasko/branches/2.0/jmdweb/model/case.py
===================================================================
--- wasko/branches/2.0/jmdweb/model/case.py	2010-03-25 07:56:28 UTC (rev 2130)
+++ wasko/branches/2.0/jmdweb/model/case.py	2010-03-25 07:57:03 UTC (rev 2131)
@@ -40,11 +40,10 @@
 
 from mpulsweb.model.user import UserObject
 from mpulsweb.model.agencysettings import Agency
+from mpulsweb.model.statement import PrivacyStatement
 from mpulsweb.model.case import MpulsCase, MpulsCaseFactory, MpulsCaseOverview, \
     MpulsCaseBundle, MpulsCaseState, SessionCase
 
-from jmdweb.model.statement import PrivacyStatement
-
 log = logging.getLogger(__name__)
 
 # SQL STATEMENTS

Deleted: wasko/branches/2.0/jmdweb/model/statement.py
===================================================================
--- wasko/branches/2.0/jmdweb/model/statement.py	2010-03-25 07:56:28 UTC (rev 2130)
+++ wasko/branches/2.0/jmdweb/model/statement.py	2010-03-25 07:57:03 UTC (rev 2131)
@@ -1,133 +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 Irländer <torsten.irlaender at intevation.de>
-#
-
-
-from string import Template
-from cgi import escape
-
-import mpulsweb.lib.helper.filters as F
-from mpulsweb.lib.db import db
-
-
-GET_STATEMENT_FLAG_SQL = """\
-SELECT einwilligung from master_tbl_view WHERE id = %(id)s"""
-SET_STATEMENT_FLAG_SQL = """\
-SELECT set_ee_status(%(id)s, %(value)s)"""
-
-
-class Statement:
-
-    def __init__(self, case, agency):
-        self.case = case
-        self.agency = agency
-
-    def fillout(self):
-        raise NotImplementedError
-
-    def decline(self):
-        pass
-
-    def sign(self):
-        pass
-
-    def keepUndefined(self):
-        pass
-
-    def isSigned(self):
-        return False
-
-class PrivacyStatement(Statement):
-
-    def fillout(self):
-        s = {
-            'VORNAME': escape(F.NA(self.case.first_name)),
-            'NACHNAME': escape(F.NA(self.case.last_name)),
-            'PLZ': escape(F.NA(self.case.plz)),
-            'STRASSE': escape(F.NA(self.case.street)),
-            'STRASSENR': escape(F.NA(self.case.streetnr)),
-            'ORT': escape(F.NA(self.case.city)),
-            'KA_NAME': escape(F.NA(self.agency.getName())),
-            'KA_SPEICHERDAUER': escape(F.NA(self.agency.getMaxSavetime()))
-            }
-        return Template(self.agency.getPrivacyStatement()).safe_substitute(s)
-
-    def sign(self):
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            cur.execute(SET_STATEMENT_FLAG_SQL,
-                        {'id': self.case.id, 'value': 1})
-            conn.commit()
-        finally:
-            db.recycleConnection(conn, cur)
-
-    def keepUndefined(self):
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            cur.execute(SET_STATEMENT_FLAG_SQL,
-                        {'id': self.case.id, 'value': -1})
-            conn.commit()
-        finally:
-            db.recycleConnection(conn, cur)
-
-    def decline(self):
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            cur.execute(SET_STATEMENT_FLAG_SQL,
-                        {'id': self.case.id, 'value': 0})
-            conn.commit()
-        finally:
-            db.recycleConnection(conn, cur)
-
-    def isSigned(self):
-        '''Returns True is teh statement is signed. False if the statement is
-        _not_ signed and will not be signed in the future. None is returned if
-        the statement is not signed yet, but might be signed in the future'''
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            cur.execute(GET_STATEMENT_FLAG_SQL, {'id': self.case.id})
-            signed = cur.fetchone()[0]
-            if signed == 1:
-                return True
-            elif signed == 0:
-                return False
-            elif signed == -1:
-                return None
-        finally:
-            db.recycleConnection(conn, cur)
-
-
-# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8:

Copied: wasko/branches/2.0/mpulsweb/model/statement.py (from rev 2126, wasko/branches/2.0/jmdweb/model/statement.py)


Property changes on: wasko/branches/2.0/mpulsweb/model/statement.py
___________________________________________________________________
Name: svn:mergeinfo
   + 



More information about the Mpuls-commits mailing list