[Mpuls-commits] r1004 - in wasko/branches/2.0: . waskaweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Jan 29 10:53:55 CET 2010
Author: bh
Date: 2010-01-29 10:53:51 +0100 (Fri, 29 Jan 2010)
New Revision: 1004
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/waskaweb/lib/db.py
Log:
* waskaweb/lib/db.py: Fix formatting
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-01-29 09:47:27 UTC (rev 1003)
+++ wasko/branches/2.0/ChangeLog 2010-01-29 09:53:51 UTC (rev 1004)
@@ -1,3 +1,7 @@
+2010-01-29 Bernhard Herzog <bh at intevation.de>
+
+ * waskaweb/lib/db.py: Fix formatting
+
2010-01-28 Bernhard Herzog <bh at intevation.de>
* waskaweb/controllers/case.py: Add some spaces to text constants
Modified: wasko/branches/2.0/waskaweb/lib/db.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/db.py 2010-01-29 09:47:27 UTC (rev 1003)
+++ wasko/branches/2.0/waskaweb/lib/db.py 2010-01-29 09:53:51 UTC (rev 1004)
@@ -1,54 +1,59 @@
# -*- 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:
# Sascha L. Teichmann <teichmann at intevation.de>
#
-from paste.registry import StackedObjectProxy
+import sys
import psycopg2 as dbapi
-import sys
+from paste.registry import StackedObjectProxy
+
db = StackedObjectProxy(name="waska.db")
+
def enter(dbObject):
db._push_object(dbObject)
+
def leave(dbObject=None):
db._pop_object(dbObject)
+
class DB:
+
def __init__(self, dbname, user, password, host='localhost', port=5432):
- self.dbname = dbname
- self.user = user
- self.password = password.replace("\\", "\\\\")
- self.host = host
- self.port = int(port)
- self.conn = None
+ self.dbname = dbname
+ self.user = user
+ self.password = password.replace("\\", "\\\\")
+ self.host = host
+ self.port = int(port)
+ self.conn = None
self.connections = []
def getConnection(self):
@@ -57,20 +62,19 @@
used[0] = True
return used[1]
- con = dbapi.connect(
- database = self.dbname,
- host = self.host,
- port = self.port,
- user = self.user,
- password = self.password)
+ con = dbapi.connect(database=self.dbname,
+ host=self.host, port=self.port,
+ user=self.user, password=self.password)
used = [True, con]
self.connections.append(used)
return con
def recycleConnection(self, con, cur=None):
if cur:
- try: cur.close()
- except: pass
+ try:
+ cur.close()
+ except:
+ pass
if con:
for used in self.connections:
if used[1] == con:
@@ -89,7 +93,9 @@
except:
pass
+
class DBInterface:
+
def acquireConnection(self):
return None
More information about the Mpuls-commits
mailing list