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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 26 09:50:58 CET 2010


Author: torsten
Date: 2010-01-26 09:50:57 +0100 (Tue, 26 Jan 2010)
New Revision: 855

Removed:
   wasko/branches/2.0/waskaweb/model/agency.py
Log:
* waskaweb/model/agency.py: Deleted not imported anywhere


Deleted: wasko/branches/2.0/waskaweb/model/agency.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/agency.py	2010-01-26 08:48:41 UTC (rev 854)
+++ wasko/branches/2.0/waskaweb/model/agency.py	2010-01-26 08:50:57 UTC (rev 855)
@@ -1,160 +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 psycopg2.extras
-import os
-from waskaweb.model.case import CaseBundle
-
-import traceback
-import sys
-
-from waskaweb.lib.db import db
-from waskaweb.lib.search import AgencySearch, CaseSearch
-from waskaweb.lib.base import session, g, h, config 
-from waskaweb.controllers.case_overview import parseSearchOptions
-
-GET_CASEIDS_SQL = """SELECT id from master_tbl_view
-                     WHERE fkz = %(id)s"""
-
-GET_AGENCYLIST_SQL = """select count(m.id), 
-                                m.fkz, 
-                                date_trunc('minute', max(s.zugriff)) 
-                                from master_tbl_view m 
-                                join ka_status_tbl_view s 
-                                on m.id = s.master_id 
-                                group by fkz"""
-
-GET_AGENCY_SQL = """select      m.id, 
-                                m.fkz, 
-                                s.zugriff 
-                                from master_tbl_view m 
-                                join ka_status_tbl_view s 
-                                on m.id = s.master_id 
-                                WHERE m.fkz = %(id)s"""
-
-class AgencyBundle:
-    def __init__(self, ids=None):
-        self.list = []
-        if ids:
-            factory = AgencyFactory()
-            for id in ids:
-                self.list.append(factory.loadByFkz(id))
-
-    def delete(self):
-        num = 0
-        for agency in self.list:
-            agency.delete()
-            num += 1
-        return num
-
-    def isEmpty(self):
-        return len(self.list) <= 0 
-
-    def getAgencys(self):
-       return self.list
-
-class AgencyFactory:
-    def loadByFkz(self, fkz):
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-            cur.execute(GET_AGENCY_SQL, {'id': fkz})
-            row = cur.fetchone()
-            agency             = Agency()
-            agency.num_cases   = row[0]
-            agency.fkz         = row[1]
-            agency.last_update = row[2]
-        finally:
-            db.recycleConnection(conn, cur)
-        return agency
-
-    def loadByData(self, fkz, num, updated):
-            agency             = Agency()
-            agency.num_cases   = num 
-            agency.fkz         = fkz 
-            agency.last_update = updated
-            return agency
-
-class AgencyOverview:
-    def __init__(self):
-        self.agency_list = []
-
-    def search(self, search_str=""):
-        factory = AgencyFactory()
-        search = AgencySearch()
-        result = search.perform(search_str)
-        for row in result:
-            self.agency_list.append(factory.loadByData(row['fkz'], row['anzahl'], row['zugriff']))
-        return self.agency_list
-
-    def getDatasets(self):
-        return self.agency_list 
-
-class Agency:
-    def __init__(self, id=None):
-        self.id          = id 
-        self.fkz         = "-/-"
-        self.num_cases   = "-/-"
-        self.last_update = "-/-"
-
-    def getCaseBundle(self):
-        ids = []
-        conn, cur = None, None
-        try:
-            conn = db.getConnection()
-            cur = conn.cursor()
-
-            search = CaseSearch()
-            form_defaults = session.get('CASE_OVERVIEW_SEARCHOPTIONS') or {}
-            search_options = parseSearchOptions(form_defaults)
-            # sql query fails if no sort order is given.
-            search_options.append('fkz:%s' % self.fkz)
-            # if no state id given in search options take default (all) states
-            if not form_defaults.has_key('state'):
-                search_options.append('state:1')
-                search_options.append('state:2')
-                search_options.append('state:3')
-                search_options.append('state:4')
-                search_options.append('state:5')
-            search_options.append('sort_field:fkz')
-            search_options.append('sort_order:asc')
-            search_str = ";".join(search_options)
-
-            result = search.perform(search_str)
-            for row in result:
-                ids.append(row['id'])
-        finally:
-            db.recycleConnection(conn, cur)
-
-        return CaseBundle(ids)
-
-    def delete(self):
-        case_bundle = self.getCaseBundle()
-        return case_bundle.delete()
-
-# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8:



More information about the Mpuls-commits mailing list