[Mpuls-commits] r594 - in waska/trunk: . waskaweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sat Sep 5 11:04:41 CEST 2009
Author: frank
Date: 2009-09-05 11:04:40 +0200 (Sat, 05 Sep 2009)
New Revision: 594
Modified:
waska/trunk/ChangeLog.txt
waska/trunk/waskaweb/model/case.py
Log:
Anonymization check for all active cases of the current period.
Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt 2009-09-05 08:37:42 UTC (rev 593)
+++ waska/trunk/ChangeLog.txt 2009-09-05 09:04:40 UTC (rev 594)
@@ -8,6 +8,18 @@
2009-09-04 Frank Koormann <frank.koormann at intevation.de>
+
+ Anonymization check for all active cases of the current period, even if
+ started in the former period (modified isYoungerThan).
+
+ * waskaweb/model/case.py (CaseList.getCases):
+ Avoid reuse of CaseFactory
+ (SessionCase.isYoungerThan, Case.isYoungerThan): Evaluate the
+ CM end date: Return True if case was active after given date.
+ (CaseFactory.loadById): Load also CM end date "beendigung_5".
+
+
+2009-09-04 Frank Koormann <frank.koormann at intevation.de>
Introduce stronger constraints for pending anonymiziation cases:
Only consistent cases with finished phase can be anonymized.
Modified: waska/trunk/waskaweb/model/case.py
===================================================================
--- waska/trunk/waskaweb/model/case.py 2009-09-05 08:37:42 UTC (rev 593)
+++ waska/trunk/waskaweb/model/case.py 2009-09-05 09:04:40 UTC (rev 594)
@@ -46,6 +46,7 @@
from waskaweb.lib.xmlexport import exportAsXML
from waskaweb.lib.base import session, g, h, config
import waskaweb.lib.filters as F
+from waskaweb.model import UNKNOWN_DATE
from waskaweb.model.user import UserObject
from waskaweb.model.agencysettings import Agency
from waskaweb.model.repeatgroup import AidList, CREATE_RG_BILDEN_DS,CREATE_RG_LEBEN_DS, CREATE_RG_QUALI_DS, CREATE_RG_BERUF_DS
@@ -170,12 +171,12 @@
def getCases(self, filter=None):
list = []
- factory = CaseFactory()
if filter:
cases = [id for id in self.case_list if id not in filter]
else:
cases = self.case_list
for id in cases:
+ factory = CaseFactory()
list.append(factory.loadById(id))
return list
@@ -387,6 +388,7 @@
case.first_name = unicode(str(result.get('vorname_1', '')), 'utf-8')
case.knr = unicode(str(result.get('kundennummer', '')), 'utf-8')
case.first_meeting = result.get('erstgespraech')
+ case.cm_end = result.get('beendigung_5')
case.editor = result.get('bearbeiter_id', None)
case.state = State(id)
return case
@@ -716,6 +718,7 @@
self.knr = None
self.state = None
self.first_meeting = None
+ self.cm_end = None
self.privacy_statement = False
self.street = None
@@ -760,10 +763,19 @@
return self.first_name
def isYoungerThan(self, mydate):
+ '''Return True if case was active relative to mydate.
+
+ Case either started or finished after mdate, or no end date set.
+ '''
y,m,d = mydate.split('-')
if self.first_meeting:
- older = self.first_meeting > date(int(y), int(m), int(d))
- return older
+ if self.first_meeting > date(int(y), int(m), int(d)):
+ return True
+ elif self.cm_end and (self.cm_end <= date(int(y), int(m), int(d))
+ and self.cm_end != UNKNOWN_DATE):
+ return False
+ else:
+ return True
return True
def save():
@@ -779,6 +791,7 @@
self.standin = None
self.state = None
self.first_meeting = None
+ self.cm_end = None
self.digest = None
self.page = None
@@ -828,6 +841,7 @@
session.knr = self.knr
session.state = self.state
session.first_meeting = self.first_meeting
+ session.cm_end = self.cm_end
privacy_statement = self.getPrivacyStatement()
session.privacy_statement = privacy_statement.isSigned()
return session
@@ -1012,10 +1026,19 @@
return self.first_name
def isYoungerThan(self, mydate):
+ '''Return True if case was active relative to mydate.
+
+ Case either started or finished after mdate, or no end date set.
+ '''
y,m,d = mydate.split('-')
if self.first_meeting:
- older = self.first_meeting > date(int(y), int(m), int(d))
- return older
+ if self.first_meeting > date(int(y), int(m), int(d)):
+ return True
+ elif self.cm_end and (self.cm_end <= date(int(y), int(m), int(d))
+ and self.cm_end != UNKNOWN_DATE):
+ return False
+ else:
+ return True
return True
class State(object):
More information about the Mpuls-commits
mailing list