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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 16 17:35:03 CET 2010


Author: bh
Date: 2010-02-16 17:35:00 +0100 (Tue, 16 Feb 2010)
New Revision: 1639

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/waskaweb/controllers/case.py
   wasko/branches/2.0/waskaweb/controllers/caseappointment.py
   wasko/branches/2.0/waskaweb/controllers/casedocument.py
   wasko/branches/2.0/waskaweb/controllers/caselifetime.py
   wasko/branches/2.0/waskaweb/lib/base.py
   wasko/branches/2.0/waskaweb/model/case.py
Log:
* waskaweb/model/case.py (CaseList.getCases)
(CaseBundle.setEditor, CaseBundle.setStandin, CaseBundle.delete)
(CaseBundle.anonymize, CaseBundle.restore)
(CaseBundle.markAnonymize, CaseBundle.markDelete)
(CaseOverview.search): Use g.case_factory instead of instantiating
CaseFactory explicitly.

* waskaweb/lib/base.py (BaseController._loadCase): Use
g.case_factory instead of instantiating CaseFactory explicitly.

* waskaweb/controllers/caselifetime.py (copy_case)
(CaselifetimeController.abortcase)
(CaselifetimeController.renew_ok)
(CaselifetimeController.reopen_ok): Use g.case_factory instead
of instantiating CaseFactory explicitly.

* waskaweb/controllers/casedocument.py (loadCase): Use
g.case_factory instead of instantiating CaseFactory explicitly.

* waskaweb/controllers/caseappointment.py (loadCase): Use
g.case_factory instead of instantiating CaseFactory explicitly.

* waskaweb/controllers/case.py (checkPrivacyStatement.validate)
(CaseController.newAction, CaseController.neuaufnahmeAction)
(CaseController.wiederaufnahmeAction): Use g.case_factory instead
of instantiating CaseFactory explicitly.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-02-16 16:14:29 UTC (rev 1638)
+++ wasko/branches/2.0/ChangeLog	2010-02-16 16:35:00 UTC (rev 1639)
@@ -1,5 +1,34 @@
 2010-02-16  Bernhard Herzog  <bh at intevation.de>
 
+	* waskaweb/model/case.py (CaseList.getCases)
+	(CaseBundle.setEditor, CaseBundle.setStandin, CaseBundle.delete)
+	(CaseBundle.anonymize, CaseBundle.restore)
+	(CaseBundle.markAnonymize, CaseBundle.markDelete)
+	(CaseOverview.search): Use g.case_factory instead of instantiating
+	CaseFactory explicitly.
+
+	* waskaweb/lib/base.py (BaseController._loadCase): Use
+	g.case_factory instead of instantiating CaseFactory explicitly.
+
+	* waskaweb/controllers/caselifetime.py (copy_case)
+	(CaselifetimeController.abortcase)
+	(CaselifetimeController.renew_ok)
+	(CaselifetimeController.reopen_ok): Use g.case_factory instead
+	of instantiating CaseFactory explicitly.
+
+	* waskaweb/controllers/casedocument.py (loadCase): Use
+	g.case_factory instead of instantiating CaseFactory explicitly.
+
+	* waskaweb/controllers/caseappointment.py (loadCase): Use
+	g.case_factory instead of instantiating CaseFactory explicitly.
+
+	* waskaweb/controllers/case.py (checkPrivacyStatement.validate)
+	(CaseController.newAction, CaseController.neuaufnahmeAction)
+	(CaseController.wiederaufnahmeAction): Use g.case_factory instead
+	of instantiating CaseFactory explicitly.
+
+2010-02-16  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/lib/app_globals.py: New.  WASKO-specific globals,
 	including the instance of CaseFactory to use to instantiate
 	WASKO-Case objects

Modified: wasko/branches/2.0/waskaweb/controllers/case.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/case.py	2010-02-16 16:14:29 UTC (rev 1638)
+++ wasko/branches/2.0/waskaweb/controllers/case.py	2010-02-16 16:35:00 UTC (rev 1639)
@@ -57,7 +57,7 @@
 from mpulsweb.model.logbook import LogbookEntry
 
 from waskaweb.model.statement import PrivacyStatement
-from waskaweb.model.case import Agency, CaseFactory, SessionCase
+from waskaweb.model.case import Agency, SessionCase
 #from waskaweb.model.casexml import import_xml, XMLImportException
 from waskaweb.model.data import DateLeaf, IntLeaf, TextLeaf, RadioNode, \
      ChoiceNode
@@ -170,8 +170,7 @@
             c.targeturl = h.url_for(controller="/case", action=context,
                                     id=case_id, confirmed=1)
 
-        factory = CaseFactory()
-        case = factory.loadById(case_id)
+        case = g.case_factory.loadById(case_id)
 
         statement = case.getPrivacyStatement()
         # Check if there is a "Einverstaendniserklaerung" None if it is
@@ -341,8 +340,7 @@
                     return render('/casemanagement/neuaufnahme.mako')
 
                 # 1. Create a new case
-                factory = CaseFactory()
-                case = factory.createNew(data=form_result)
+                case = g.case_factory.createNew(data=form_result)
                 statement = case.getPrivacyStatement()
 
                 # 2. Do we want to sign the statement?
@@ -378,8 +376,7 @@
                 simulation = g.formedTree.dryConvertAgainstDefaults(form_result)
 
                 # 1. Create a new case
-                factory = CaseFactory()
-                case = factory.createNew(data=session_case.toFormData())
+                case = g.case_factory.createNew(data=session_case.toFormData())
                 statement = case.getPrivacyStatement()
 
                 # 2. Do we want to sign the statement?
@@ -450,8 +447,7 @@
                 simulation = g.formedTree.dryConvertAgainstDefaults(form_result)
 
                 # 1. Create a new case
-                factory = CaseFactory()
-                case = factory.createNew(data=session_case.toFormData())
+                case = g.case_factory.createNew(data=session_case.toFormData())
                 statement = case.getPrivacyStatement()
 
                 # 2. Do we want to sign the statement?

Modified: wasko/branches/2.0/waskaweb/controllers/caseappointment.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/caseappointment.py	2010-02-16 16:14:29 UTC (rev 1638)
+++ wasko/branches/2.0/waskaweb/controllers/caseappointment.py	2010-02-16 16:35:00 UTC (rev 1639)
@@ -22,7 +22,7 @@
 
 from waskaweb.lib.base import BaseController, render
 from waskaweb.lib.validators import CreateAppointmentForm
-from waskaweb.model.case import CaseFactory, LoadCaseNotExistsError
+from waskaweb.model.case import LoadCaseNotExistsError
 from waskaweb.model.appointment import CaseAppointmentOverview, \
      CaseAppointmentFactory, CaseReminderOverview
 from waskaweb.controllers.case import checkPrivacyStatement
@@ -30,7 +30,7 @@
 log = logging.getLogger(__name__)
 
 def loadCase(id):
-    factory = CaseFactory()
+    factory = g.case_factory
     try:
         return factory.loadById(id)
     except LoadCaseNotExistsError, err:

Modified: wasko/branches/2.0/waskaweb/controllers/casedocument.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/casedocument.py	2010-02-16 16:14:29 UTC (rev 1638)
+++ wasko/branches/2.0/waskaweb/controllers/casedocument.py	2010-02-16 16:35:00 UTC (rev 1639)
@@ -10,8 +10,8 @@
 import mpulsweb.lib.helpers as h
 from mpulsweb.model.document import Document, deleteDocument
 
-from waskaweb.lib.base import BaseController, render
-from waskaweb.model.case import CaseFactory, LoadCaseNotExistsError
+from waskaweb.lib.base import BaseController, g, render
+from waskaweb.model.case import LoadCaseNotExistsError
 
 
 log = logging.getLogger(__name__)
@@ -36,7 +36,7 @@
 
 
 def loadCase(id):
-    factory = CaseFactory()
+    factory = g.case_factory
     try:
         return factory.loadById(id)
     except LoadCaseNotExistsError, err:

Modified: wasko/branches/2.0/waskaweb/controllers/caselifetime.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/caselifetime.py	2010-02-16 16:14:29 UTC (rev 1638)
+++ wasko/branches/2.0/waskaweb/controllers/caselifetime.py	2010-02-16 16:35:00 UTC (rev 1639)
@@ -187,8 +187,7 @@
     myfields = extract_data_from_case(id, fields, ignore)
     try:
         # create new case and store fields form the old case in the new case
-        factory = CaseFactory()
-        case = factory.createNew(data={})
+        case = g.case_factory.createNew(data={})
         myfields.storeData(case.id)
     except:
         traceback.print_exc(file=sys.stderr)
@@ -417,8 +416,7 @@
     def abortcase(self, id, confirmed='0'):
         if confirmed == '1':
             # mark case for deletion
-            factory = CaseFactory()
-            case = factory.loadById(session['case'].id)
+            case = g.case_factory.loadById(session['case'].id)
             case.setState(3)
             c.success_for = ABORT_SUCCESS_HEADER
             c.success_text = ABORT_SUCCESS_TEXT
@@ -494,8 +492,7 @@
                                      ' des Integrationsprozess dokumentiert.'))
 
                 # markiere den alten Fall zur Anonymisierung
-                factory = CaseFactory()
-                old_case = factory.loadById(session['case'].id)
+                old_case = g.case_factory.loadById(session['case'].id)
                 old_case.setState(4)
                 mark_case(old_case.id, 'NAU')
                 create_logbook(header='Neuaufnahme',
@@ -566,8 +563,7 @@
                                          ' Integrationsprozess dokumentiert.'))
 
                     # Markiere alten Fall zur Anonymisierung
-                    factory = CaseFactory()
-                    old_case = factory.loadById(id)
+                    old_case = g.case_factory.loadById(id)
                     old_case.setState(4)
                     mark_case(old_case.id, 'WAU')
                     create_logbook(id=id, header='Wiederaufnahme',

Modified: wasko/branches/2.0/waskaweb/lib/base.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/base.py	2010-02-16 16:14:29 UTC (rev 1638)
+++ wasko/branches/2.0/waskaweb/lib/base.py	2010-02-16 16:35:00 UTC (rev 1639)
@@ -31,7 +31,7 @@
 from mpulsweb.lib.base import _, BaseController as MpulsBaseController, \
               c, g, h, redirect_to, render, request, response, session
 
-from waskaweb.model.case import CaseFactory, LoadCaseNotExistsError
+from waskaweb.model.case import LoadCaseNotExistsError
 
 class BaseController(MpulsBaseController):
 
@@ -39,7 +39,7 @@
         MpulsBaseController.__init__(self)
 
     def _loadCase(self, id):
-        factory = CaseFactory()
+        factory = g.case_factory
         try:
             return factory.loadById(id)
         except LoadCaseNotExistsError, err:

Modified: wasko/branches/2.0/waskaweb/model/case.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/case.py	2010-02-16 16:14:29 UTC (rev 1638)
+++ wasko/branches/2.0/waskaweb/model/case.py	2010-02-16 16:35:00 UTC (rev 1639)
@@ -189,8 +189,7 @@
         else:
             cases = self.case_list
         for id in cases:
-            factory = CaseFactory()
-            list.append(factory.loadById(id))
+            list.append(g.case_factory.loadById(id))
         return list
 
 
@@ -200,7 +199,7 @@
         CaseList.__init__(self, case_ids)
 
     def setEditor(self, user_id):
-        factory = CaseFactory()
+        factory = g.case_factory
         num = 0
         for id in self.case_list:
             case = factory.loadById(id)
@@ -212,7 +211,7 @@
         return num
 
     def setStandin(self, group_ids):
-        factory = CaseFactory()
+        factory = g.case_factory
         num = 0
         for id in self.case_list:
             case = factory.loadById(id)
@@ -225,7 +224,7 @@
         return num
 
     def delete(self):
-        factory = CaseFactory()
+        factory = g.case_factory
         num = 0
         for id in self.case_list:
             case = factory.loadById(id)
@@ -237,7 +236,7 @@
         return num
 
     def anonymize(self):
-        factory = CaseFactory()
+        factory = g.case_factory
         num = 0
         for id in self.case_list:
             case = factory.loadById(id)
@@ -249,7 +248,7 @@
         return num
 
     def restore(self):
-        factory = CaseFactory()
+        factory = g.case_factory
         num = 0
         for id in self.case_list:
             case = factory.loadById(id)
@@ -261,7 +260,7 @@
         return num
 
     def markAnonymize(self):
-        factory = CaseFactory()
+        factory = g.case_factory
         num = 0
         for id in self.case_list:
             case = factory.loadById(id)
@@ -274,7 +273,7 @@
         return num
 
     def markDelete(self):
-        factory = CaseFactory()
+        factory = g.case_factory
         num = 0
         for id in self.case_list:
             case = factory.loadById(id)
@@ -339,7 +338,7 @@
         search = CaseSearch(Case.get_search_retrieve_fields(),
                             Case.get_search_match_fields())
         result = search.perform(search_str)
-        factory = CaseFactory()
+        factory = g.case_factory
         for row in result:
             case = factory.loadFromQueryResult(row)
             self.ds_list.append(case)
@@ -1127,7 +1126,7 @@
     def phasesAreConsistent(self):
         """Returns True when the required fields for the current phase are
         complete and there are no other inconsistencys. Else False"""
-        #case = CaseFactory().loadById(self.master_id) # Ugly we need to load the case here :(
+        #case = g.case_factory.loadById(self.master_id) # Ugly we need to load the case here :(
         cf = self.getPhase()
         rf = RequiredFields(g.formedTree)
         p_pairs = rf.phases_pairs(cf, master_id=self.master_id)



More information about the Mpuls-commits mailing list