[Mpuls-commits] r930 - in wasko/branches/2.0: . waskaweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Jan 26 20:05:56 CET 2010
Author: bh
Date: 2010-01-26 20:05:55 +0100 (Tue, 26 Jan 2010)
New Revision: 930
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/waskaweb/model/statement.py
Log:
* waskaweb/model/statement.py: Fix formatting
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-01-26 18:10:45 UTC (rev 929)
+++ wasko/branches/2.0/ChangeLog 2010-01-26 19:05:55 UTC (rev 930)
@@ -1,5 +1,9 @@
2010-01-26 Bernhard Herzog <bh at intevation.de>
+ * waskaweb/model/statement.py: Fix formatting
+
+2010-01-26 Bernhard Herzog <bh at intevation.de>
+
* waskaweb/controllers/statement.py: Expand star imports and
remove unused imports.
Modified: wasko/branches/2.0/waskaweb/model/statement.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/statement.py 2010-01-26 18:10:45 UTC (rev 929)
+++ wasko/branches/2.0/waskaweb/model/statement.py 2010-01-26 19:05:55 UTC (rev 930)
@@ -1,47 +1,52 @@
# -*- 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>
#
-from waskaweb.lib.db import db
from string import Template
+from cgi import escape
+
import waskaweb.lib.filters as F
+from waskaweb.lib.db import db
-from cgi import escape
-#GET_STATEMENT_FLAG_SQL = """SELECT einwilligung from ee_view WHERE id = %(id)s"""
-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)"""
+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, id=None):
self.case_id = id
self.content = ""
-
+
def _substitute(self, client, agency):
return ''
@@ -66,15 +71,17 @@
def isSigned(self):
return False
+
class DiscretionStatement(Statement):
+
def __init__(self, id=None):
Statement.__init__(self, id)
def fillout(self, client, agency, **kwargs):
tmpl = agency.getDiscretionStatement()
self.template = Template(tmpl)
- self.content = self._substitute(client, agency)
- return self.content
+ self.content = self._substitute(client, agency)
+ return self.content
def _substitute(self, client, agency):
# Substitution dictionary
@@ -87,14 +94,15 @@
return result
class PrivacyStatement(Statement):
+
def __init__(self, id=None):
Statement.__init__(self, id)
def fillout(self, client, agency, **kwargs):
tmpl = agency.getPrivacyStatement()
self.template = Template(tmpl)
- self.content = self._substitute(client, agency)
- return self.content
+ self.content = self._substitute(client, agency)
+ return self.content
def _substitute(self, client, agency):
# Substitution dictionary
@@ -109,14 +117,15 @@
'KA_SPEICHERDAUER': escape(F.NA(agency.getMaxSavetime()))
}
result = self.template.safe_substitute(s)
- return result
+ return result
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})
+ cur.execute(SET_STATEMENT_FLAG_SQL,
+ {'id': self.case_id, 'value': 1})
conn.commit()
finally:
db.recycleConnection(conn, cur)
@@ -126,7 +135,8 @@
try:
conn = db.getConnection()
cur = conn.cursor()
- cur.execute(SET_STATEMENT_FLAG_SQL, {'id': self.case_id, 'value': -1})
+ cur.execute(SET_STATEMENT_FLAG_SQL,
+ {'id': self.case_id, 'value': -1})
conn.commit()
finally:
db.recycleConnection(conn, cur)
@@ -136,7 +146,8 @@
try:
conn = db.getConnection()
cur = conn.cursor()
- cur.execute(SET_STATEMENT_FLAG_SQL, {'id': self.case_id, 'value': 0})
+ cur.execute(SET_STATEMENT_FLAG_SQL,
+ {'id': self.case_id, 'value': 0})
conn.commit()
finally:
db.recycleConnection(conn, cur)
@@ -151,9 +162,12 @@
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
+ if signed == 1:
+ return True
+ elif signed == 0:
+ return False
+ elif signed == -1:
+ return None
finally:
db.recycleConnection(conn, cur)
More information about the Mpuls-commits
mailing list