[Mpuls-commits] r1219 - in wasko/branches/2.0: . mpulsweb/lib waskaweb/controllers waskaweb/lib waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 3 15:46:25 CET 2010


Author: torsten
Date: 2010-02-03 15:46:21 +0100 (Wed, 03 Feb 2010)
New Revision: 1219

Added:
   wasko/branches/2.0/mpulsweb/lib/db.py
Removed:
   wasko/branches/2.0/waskaweb/lib/db.py
Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/lib/base.py
   wasko/branches/2.0/waskaweb/controllers/case.py
   wasko/branches/2.0/waskaweb/controllers/caselifetime.py
   wasko/branches/2.0/waskaweb/controllers/evaluate.py
   wasko/branches/2.0/waskaweb/controllers/formularpage.py
   wasko/branches/2.0/waskaweb/controllers/repeatgroup.py
   wasko/branches/2.0/waskaweb/lib/evaluation.py
   wasko/branches/2.0/waskaweb/lib/navigation.py
   wasko/branches/2.0/waskaweb/lib/renderer.py
   wasko/branches/2.0/waskaweb/lib/search.py
   wasko/branches/2.0/waskaweb/lib/security.py
   wasko/branches/2.0/waskaweb/lib/validators.py
   wasko/branches/2.0/waskaweb/model/agencysettings.py
   wasko/branches/2.0/waskaweb/model/appointment.py
   wasko/branches/2.0/waskaweb/model/case.py
   wasko/branches/2.0/waskaweb/model/casexml.py
   wasko/branches/2.0/waskaweb/model/document.py
   wasko/branches/2.0/waskaweb/model/logbook.py
   wasko/branches/2.0/waskaweb/model/news.py
   wasko/branches/2.0/waskaweb/model/statement.py
   wasko/branches/2.0/waskaweb/model/user.py
Log:
Moved lib.db from waskaweb into mpulsweb. Adopted import paths


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/ChangeLog	2010-02-03 14:46:21 UTC (rev 1219)
@@ -1,3 +1,29 @@
+2010-02-03  Torsten Irländer <torsten.irlaender at intevation.de>
+	
+	* mpulsweb/lib/db.py, 
+	  waskaweb/lib/db.py: Moved file 
+	* mpulsweb/lib/base.py,
+	  waskaweb/model/casexml.py,
+	  waskaweb/model/logbook.py,
+	  waskaweb/model/appointment.py,
+	  waskaweb/model/statement.py,
+	  waskaweb/model/case.py,
+	  waskaweb/model/news.py,
+	  waskaweb/model/document.py,
+	  waskaweb/model/user.py,
+	  waskaweb/model/agencysettings.py,
+	  waskaweb/controllers/caselifetime.py,
+	  waskaweb/controllers/repeatgroup.py,
+	  waskaweb/controllers/evaluate.py,
+	  waskaweb/controllers/case.py,
+	  waskaweb/controllers/formularpage.py,
+	  waskaweb/lib/navigation.py,
+	  waskaweb/lib/search.py,
+	  waskaweb/lib/renderer.py,
+	  waskaweb/lib/evaluation.py,
+	  waskaweb/lib/security.py,
+	  waskaweb/lib/validators.py: Import from mpulsweb.lib.db now.
+
 2010-02-03  Bernhard Herzog  <bh at intevation.de>
 
 	* waskaweb/model/case.py: Remove unused imports

Modified: wasko/branches/2.0/mpulsweb/lib/base.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/base.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/mpulsweb/lib/base.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -41,7 +41,7 @@
 from pylons.templating import render
 
 import waskaweb.lib.helpers as h
-import waskaweb.lib.db as db
+import mpulsweb.lib.db as db
 from waskaweb.lib.timelog import timeLog
 from waskaweb.lib.security import HOST, PORT, DBNAME, USER, getDbName, \
      userIdentity

Copied: wasko/branches/2.0/mpulsweb/lib/db.py (from rev 1211, wasko/branches/2.0/waskaweb/lib/db.py)


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

Modified: wasko/branches/2.0/waskaweb/controllers/case.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/case.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/controllers/case.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -41,7 +41,7 @@
 
 from waskaweb.lib.base import c, g, h, redirect_to, render, request, session
 
-from waskaweb.lib.db import db
+from mpulsweb.lib.db import db
 from waskaweb.lib.search import INCONSISTENCY_CHECK_AFTER
 
 from waskaweb.lib.navigation import get_navigation

Modified: wasko/branches/2.0/waskaweb/controllers/caselifetime.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/caselifetime.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/controllers/caselifetime.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -20,7 +20,7 @@
 from waskaweb.controllers.CaseBase import CasebaseController
 
 from formed.instance.backends.postgres import DBFactory as InstanceFactory
-from waskaweb.lib.db import db, PostgresDBInterface
+from mpulsweb.lib.db import db, PostgresDBInterface
 
 
 log = logging.getLogger(__name__)

Modified: wasko/branches/2.0/waskaweb/controllers/evaluate.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/evaluate.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/controllers/evaluate.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -7,7 +7,7 @@
 from pylons import session, g, c
 from waskaweb.lib.validators import EvaluationFormValidator
 from waskaweb.lib.base import *
-from waskaweb.lib.db import db
+from mpulsweb.lib.db import db
 from waskaweb.lib.helpers import format_date, get_phasesuccessors 
 from libmpuls.evaluation.config import EvaluationConfig
 from libmpuls.evaluation.evaluation import EvaluationSet

Modified: wasko/branches/2.0/waskaweb/controllers/formularpage.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/formularpage.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/controllers/formularpage.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -11,7 +11,7 @@
 from waskaweb.lib.security          import checkRole
 
 from waskaweb.lib.base import BaseController, render
-from waskaweb.lib.db import  PostgresDBInterface
+from mpulsweb.lib.db import  PostgresDBInterface
 from waskaweb.lib.navigation import  mark_folderopen 
 
 from waskaweb.lib.renderer import  ViewRenderer, RepeatGroupRenderer, ErrorRenderer

Modified: wasko/branches/2.0/waskaweb/controllers/repeatgroup.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/repeatgroup.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/controllers/repeatgroup.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -9,7 +9,7 @@
 from pylons.controllers.util import abort, redirect_to
 
 from waskaweb.lib.base import BaseController, render
-from waskaweb.lib.db import  PostgresDBInterface
+from mpulsweb.lib.db import  PostgresDBInterface
 
 from waskaweb.lib.navigation import  get_navigation 
 from waskaweb.controllers.formularpage import FormularpageController 

Deleted: wasko/branches/2.0/waskaweb/lib/db.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/db.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/lib/db.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -1,128 +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:
-# Sascha L. Teichmann <teichmann at intevation.de>
-#
-
-import sys
-import logging
-
-import psycopg2 as dbapi
-import psycopg2.extensions
-
-from paste.registry import StackedObjectProxy
-
-
-log = logging.getLogger(__name__)
-
-
-# Make psycopg2 return unicode objects for strings in query results.
-# This is probably not the best way to deal with unicode and the DB-API.
-# In particular, it's obviously not directly portable to other DB-API
-# implementations.
-psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
-
-
-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.connections = []
-
-    def getConnection(self):
-        for used in self.connections:
-            if not used[0]:
-                used[0] = True
-                return used[1]
-
-        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:
-                log.exception("Error ignored while closing cursor")
-        if con:
-            for used in self.connections:
-                if used[1] == con:
-                    used[0] = False
-                    return
-            log.warning("WARNING: tried to recycle unused connection")
-
-    def closeConnections(self):
-        cons = self.connections
-        self.connections = []
-        for used in cons:
-            if used[0]:
-                log.warning("WARNING: Closing an unrecycled connection")
-            try:
-                used[1].close()
-            except:
-                log.exception("Error ignored while closing connection")
-
-
-class DBInterface:
-
-    def acquireConnection(self):
-        return None
-
-    def releaseConnection(self):
-        pass
-
-class PostgresDBInterface(DBInterface):
-
-    def acquireCursor(self):
-        conn = db.getConnection()
-        return conn.cursor()
-
-    def releaseCursor(self, cursor):
-        conn = cursor.connection
-        db.recycleConnection(conn, cursor)
-
-# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

Modified: wasko/branches/2.0/waskaweb/lib/evaluation.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/evaluation.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/lib/evaluation.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -32,7 +32,7 @@
 
 from waskaweb.lib.helpers import format_number, timedelta_in_minutes 
 from waskaweb.lib.base import _, c, session
-from waskaweb.lib.db import db
+from mpulsweb.lib.db import db
 from waskaweb.lib.sql_helper import where_ids
 from waskaweb.model.logbook import KIND2TEXT, SUMKIND2TEXT  
 

Modified: wasko/branches/2.0/waskaweb/lib/navigation.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/navigation.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/lib/navigation.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -39,7 +39,7 @@
      RepeatInstanceNode
 from formed.instance.backends.postgres import DBFactory as InstanceFactory
 
-from waskaweb.lib.db import PostgresDBInterface
+from mpulsweb.lib.db import PostgresDBInterface
 from waskaweb.lib.filecache import FileCache
 
 SELECT_ITEM = u"/formularpage/select/%s"

Modified: wasko/branches/2.0/waskaweb/lib/renderer.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/renderer.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/lib/renderer.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -34,7 +34,7 @@
 from formed.meta.nodecomponents import NodeComponent as MetaNodeComponent
 from formed.instance.tree import RepeatInstanceContainerNode, RepeatInstanceNode 
 from formed.instance.backends.postgres import DBFactory as InstanceFactory
-from waskaweb.lib.db import PostgresDBInterface 
+from mpulsweb.lib.db import PostgresDBInterface 
 from waskaweb.lib.filters import NA
 from waskaweb.lib.helpers import dd_mm_YYYY as format_date 
 import formed.meta.data as data

Modified: wasko/branches/2.0/waskaweb/lib/search.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/search.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/lib/search.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -34,7 +34,7 @@
 
 import psycopg2.extras
 
-from waskaweb.lib.db import db
+from mpulsweb.lib.db import db
 from waskaweb.lib.security import hasRole
 
 SAVE_SEARCH = re.compile(r'[^\w:;\-\. ]', re.UNICODE)

Modified: wasko/branches/2.0/waskaweb/lib/security.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/security.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/lib/security.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -47,7 +47,7 @@
 from paste.httpexceptions import HTTPUnauthorized
 from pylons import request, session, config
 
-from waskaweb.lib.db import DB, db, enter, leave
+from mpulsweb.lib.db import DB, db, enter, leave
 
 
 log = logging.getLogger(__name__)

Modified: wasko/branches/2.0/waskaweb/lib/validators.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/validators.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/lib/validators.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -25,7 +25,7 @@
 import locale
 from pylons import session, g
 from pylons.i18n import _
-from waskaweb.lib.db import db
+from mpulsweb.lib.db import db
 import re
 import formencode
 import datetime

Modified: wasko/branches/2.0/waskaweb/model/agencysettings.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/agencysettings.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/model/agencysettings.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -34,7 +34,7 @@
 import psycopg2.extras
 
 from waskaweb.lib.config import get_path
-from waskaweb.lib.db import db
+from mpulsweb.lib.db import db
 from waskaweb.lib.helpers import ensure_unicode
 
 

Modified: wasko/branches/2.0/waskaweb/model/appointment.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/appointment.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/model/appointment.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -32,7 +32,7 @@
 
 import waskaweb.lib.helpers as h
 from waskaweb.lib.base import session
-from waskaweb.lib.db import db
+from mpulsweb.lib.db import db
 from waskaweb.model.agencysettings import Agency
 from waskaweb.model.case import CaseOverview
 

Modified: wasko/branches/2.0/waskaweb/model/case.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/case.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/model/case.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -46,7 +46,7 @@
 
 from waskaweb.lib.base import session, g
 from waskaweb.lib.helpers import ensure_unicode
-from waskaweb.lib.db import db, PostgresDBInterface
+from mpulsweb.lib.db import db, PostgresDBInterface
 from waskaweb.lib.search import CaseSearch
 #from waskaweb.lib.csv import exportAsCSV
 #from waskaweb.lib.excel import exportAsXLS

Modified: wasko/branches/2.0/waskaweb/model/casexml.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/casexml.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/model/casexml.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -30,7 +30,7 @@
 
 from waskaweb.lib.uuid import uuid4
 
-from waskaweb.lib.db   import db
+from mpulsweb.lib.db   import db
 
 from waskaweb.lib.xmlhelper import \
     decode_int,                    \

Modified: wasko/branches/2.0/waskaweb/model/document.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/document.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/model/document.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -33,7 +33,7 @@
 import psycopg2  as dbapi
 import cStringIO as StringIO
 
-from waskaweb.lib.db import db
+from mpulsweb.lib.db import db
 
 MAX_SIZE   = 10*1024*1024
 BLOCK_SIZE = 4*1024

Modified: wasko/branches/2.0/waskaweb/model/logbook.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/logbook.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/model/logbook.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -31,7 +31,7 @@
 import logging
 from datetime import timedelta, datetime
 
-from waskaweb.lib.db import db
+from mpulsweb.lib.db import db
 import waskaweb.lib.helpers as h
 from waskaweb.lib.sql_helper import range_compress
 from waskaweb.model.case import CaseBundle

Modified: wasko/branches/2.0/waskaweb/model/news.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/news.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/model/news.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -31,7 +31,7 @@
 import os
 import traceback
 import sys
-from waskaweb.lib.db import db
+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"""
 

Modified: wasko/branches/2.0/waskaweb/model/statement.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/statement.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/model/statement.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -32,7 +32,7 @@
 from cgi import escape
 
 import waskaweb.lib.filters as F
-from waskaweb.lib.db import db
+from mpulsweb.lib.db import db
 
 
 GET_STATEMENT_FLAG_SQL = """\

Modified: wasko/branches/2.0/waskaweb/model/user.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/user.py	2010-02-03 14:10:29 UTC (rev 1218)
+++ wasko/branches/2.0/waskaweb/model/user.py	2010-02-03 14:46:21 UTC (rev 1219)
@@ -29,7 +29,7 @@
 
 import waskaweb.lib.helpers as h
 from waskaweb.lib.security import getDbName
-from waskaweb.lib.db import db
+from mpulsweb.lib.db import db
 
 
 MARK_NEWS_AS_READ_SQL = """SELECT markNewsAsRead(%(user_id)s, %(news_id)s)"""



More information about the Mpuls-commits mailing list