[Mpuls-commits] r4180 - in base/trunk: . mpulsweb/controllers mpulsweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Nov 15 20:20:52 CET 2010
Author: bh
Date: 2010-11-15 20:20:50 +0100 (Mon, 15 Nov 2010)
New Revision: 4180
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/controllers/evaluate.py
base/trunk/mpulsweb/model/phase.py
Log:
* mpulsweb/controllers/evaluate.py (get_phasesuccessors),
mpulsweb/model/phase.py (get_phasesuccessors): Move
get_phasesuccessors from controllers/evaluate.py to model/phase.py
so that it can be reused by other code more easily.
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-11-15 17:51:47 UTC (rev 4179)
+++ base/trunk/ChangeLog 2010-11-15 19:20:50 UTC (rev 4180)
@@ -1,3 +1,10 @@
+2010-11-15 Bernhard Herzog <bh at intevation.de>
+
+ * mpulsweb/controllers/evaluate.py (get_phasesuccessors),
+ mpulsweb/model/phase.py (get_phasesuccessors): Move
+ get_phasesuccessors from controllers/evaluate.py to model/phase.py
+ so that it can be reused by other code more easily.
+
2010-11-15 Roland Geider <roland.geider at intevation.de>
* mpulsweb/controllers/case.py: issue1351: fix plural form in
Modified: base/trunk/mpulsweb/controllers/evaluate.py
===================================================================
--- base/trunk/mpulsweb/controllers/evaluate.py 2010-11-15 17:51:47 UTC (rev 4179)
+++ base/trunk/mpulsweb/controllers/evaluate.py 2010-11-15 19:20:50 UTC (rev 4180)
@@ -14,7 +14,7 @@
from mpulsweb.lib.base import BaseController, render, request, response, session
from mpulsweb.lib.db import db
from mpulsweb.lib.validators import EvaluationFormValidator
-from mpulsweb.model.phase import PhaseFactory
+from mpulsweb.model.phase import PhaseFactory, get_phasesuccessors
log = logging.getLogger(__name__)
@@ -48,19 +48,6 @@
return sdate, edate
-def get_phasesuccessors(p):
- suc = []
- phaselist = PhaseFactory().build()
- for phase in phaselist:
- if p == phase.id:
- suc.append(phase.start.id)
- suc.append(phase.end.id)
- for ppid in phase.end.suc:
- pp = phaselist.get_phase(ppid)
- suc.extend(get_phasesuccessors(pp.phase))
- return suc
-
-
def get_search_options(soptions=None, id=None, selected_ids=()):
options = {}
options['id'] = id
Modified: base/trunk/mpulsweb/model/phase.py
===================================================================
--- base/trunk/mpulsweb/model/phase.py 2010-11-15 17:51:47 UTC (rev 4179)
+++ base/trunk/mpulsweb/model/phase.py 2010-11-15 19:20:50 UTC (rev 4180)
@@ -51,6 +51,20 @@
result['time'].append(id)
return result
+
+def get_phasesuccessors(p):
+ suc = []
+ phaselist = PhaseFactory().build()
+ for phase in phaselist:
+ if p == phase.id:
+ suc.append(phase.start.id)
+ suc.append(phase.end.id)
+ for ppid in phase.end.suc:
+ pp = phaselist.get_phase(ppid)
+ suc.extend(get_phasesuccessors(pp.phase))
+ return suc
+
+
class ConsistenceCheckException(Exception):
def __init__(self, value):
More information about the Mpuls-commits
mailing list