[Mpuls-commits] r1675 - in wasko/branches/2.0: . waskaweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Feb 22 13:17:36 CET 2010
Author: bh
Date: 2010-02-22 13:17:36 +0100 (Mon, 22 Feb 2010)
New Revision: 1675
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/waskaweb/model/case.py
Log:
* waskaweb/model/case.py (Case.init_state): New method to
instantiate the State object.
(Case.__init__): Add parameters: state_id=None, state_status,
state_access. These are passed through to init_state to
instatiate the State object
(CaseFactory.loadById, CaseFactory.loadFromQueryResult): Do not
instatiate State here, let the Case object do it.
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-02-22 12:08:08 UTC (rev 1674)
+++ wasko/branches/2.0/ChangeLog 2010-02-22 12:17:36 UTC (rev 1675)
@@ -1,5 +1,15 @@
2010-02-22 Bernhard Herzog <bh at intevation.de>
+ * waskaweb/model/case.py (Case.init_state): New method to
+ instantiate the State object.
+ (Case.__init__): Add parameters: state_id=None, state_status,
+ state_access. These are passed through to init_state to
+ instatiate the State object
+ (CaseFactory.loadById, CaseFactory.loadFromQueryResult): Do not
+ instatiate State here, let the Case object do it.
+
+2010-02-22 Bernhard Herzog <bh at intevation.de>
+
* waskaweb/model/case.py (State.__init__): Add parameters: id,
state, access. Now it's possible to instantiate State in one go,
without having to call setData separately.
Modified: wasko/branches/2.0/waskaweb/model/case.py
===================================================================
--- wasko/branches/2.0/waskaweb/model/case.py 2010-02-22 12:08:08 UTC (rev 1674)
+++ wasko/branches/2.0/waskaweb/model/case.py 2010-02-22 12:17:36 UTC (rev 1675)
@@ -358,8 +358,7 @@
finally:
db.recycleConnection(conn, c)
- return self.case_cls(id, state=State(master_id=id),
- preset=self._build_preset(result))
+ return self.case_cls(id, preset=self._build_preset(result))
def loadFromQueryResult(self, result):
"""Create a Case object from a DB query result row.
@@ -371,10 +370,10 @@
following fields that will be used to instantiate the State
object: s_id, status, zugriff
"""
- id = result["id"]
- state = State()
- state.setData(result["s_id"], id, result["status"], result["zugriff"])
- return self.case_cls(id, state=state, preset=self._build_preset(result))
+ return self.case_cls(result["id"], preset=self._build_preset(result),
+ state_id=result["s_id"],
+ state_status=result["status"],
+ state_access=result["zugriff"])
def createNew(self, init=True, uuid=None, data=None):
"""Create a new case in the database and return the case object.
@@ -580,9 +579,10 @@
class Case(MpulsCase):
- def __init__(self, id=None, state=None, preset=None):
+ def __init__(self, id=None, preset=None, state_id=None, state_status=None,
+ state_access=None):
MpulsCase.__init__(self, id=id, preset=preset)
- self.state = state
+ self.init_state(state_id, state_status, state_access)
self.standin = None
self.digest = None
self.documents = []
@@ -590,6 +590,9 @@
self.privacy_statement = None
self.discretion_statement = None
+ def init_state(self, state_id, status, access):
+ self.state = State(state_id, self.id, status, access)
+
def delete(self):
"""Deletes the case from data base. Returns True if deletion succseeds
"""
More information about the Mpuls-commits
mailing list