[Mpuls-commits] r1738 - in wasko/branches/2.0: . jmdweb/controllers mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 24 11:57:22 CET 2010


Author: torsten
Date: 2010-02-24 11:57:21 +0100 (Wed, 24 Feb 2010)
New Revision: 1738

Added:
   wasko/branches/2.0/mpulsweb/controllers/phase.py
Removed:
   wasko/branches/2.0/jmdweb/controllers/phase.py
Modified:
   wasko/branches/2.0/ChangeLog
Log:
Moved phase controller to mpulsbase


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-02-24 10:51:27 UTC (rev 1737)
+++ wasko/branches/2.0/ChangeLog	2010-02-24 10:57:21 UTC (rev 1738)
@@ -24,6 +24,9 @@
 	* waskaweb/controllers/phase.py: Import PhaseFactory from mpulsbase 
 	* mpulsweb/controllers/phase.py: Import PhaseFactory from mpulsbase 
 
+	* mpulsweb/controllers/phase.py,
+	  jmdweb/controllers/phase.py: Moved phasecontroller to mpulsbase
+
 2010-02-24  Bernhard Herzog  <bh at intevation.de>
 
 	* mpulsweb/lib/renderer.py (ViewRenderer._renderText)

Deleted: wasko/branches/2.0/jmdweb/controllers/phase.py
===================================================================
--- wasko/branches/2.0/jmdweb/controllers/phase.py	2010-02-24 10:51:27 UTC (rev 1737)
+++ wasko/branches/2.0/jmdweb/controllers/phase.py	2010-02-24 10:57:21 UTC (rev 1738)
@@ -1,116 +0,0 @@
-# -*- coding: utf-8 -*-
-import logging
-
-from pylons import session, g, c
-
-from mpulsweb.lib.security import checkRole
-from mpulsweb.model.phase import PhaseFactory
-
-from jmdweb.lib.base import BaseController, h, render, request
-
-SET_PHASE_NOTIFICATION_SUCCESS = u"""Phase gewechselt!"""
-SET_PHASE_NOTIFICATION_TEXT_SUCCESS= u"""\
-Die Phase konnte erfolgreich gewechselt werden. Bitte folgen Sie den
-aufgeführten Schritten, um zur Phasenübersicht fortzufahren."""
-
-log = logging.getLogger(__name__)
-
-class PhaseController(BaseController):
-
-    @checkRole(('admin_ka', 'cm_ka'))
-    def index(self, id):
-        return self.overview(id)
-
-    @checkRole(('admin_ka', 'cm_ka'))
-    def overview(self, id):
-        id = self._checkInt(id)
-        c.phases = PhaseFactory().load(id)
-        return render('/phase/phase.mako')
-
-    # Old methods from controllers.case.
-    # TODO: Reimplement these functions using the new libformed
-
-    #@checkRole(('admin_ka', 'cm_ka'))
-    #def phase(self, id):
-    #    id = self._checkInt(id)
-    #    case = self._loadCase(id)
-    #    phase = case.getState().getPhase()
-
-    #    # FIXME: the links generated by link are very likely wrong.
-    #    # They should point to formularpage/select.
-    #    link = lambda ti, extra = "": '"/case/show/%d/%s%s"' % (id, ti.key,
-    #                                                            extra)
-
-    #    rf = RequiredFields(g.formedTree)
-
-    #    navigation = self.getNavigation()
-
-    #    c.phase_pairs = rf.phases_pairs(phase, navigation, link)
-    #    c.current_phase = Phase(phase, True)
-
-    #    D = g.formedTree.getData
-    #    nbtr = int(D('nbtr'))
-    #    abbr = int(D('cm_end_art'))
-    #    c.nachbetreuung_geplant = nbtr not in [1,-1,-3] and abbr != 3
-
-    #    c.global_warnings = g.formedTree.linksToGlobalWarnings(id, navigation,
-    #                                                           link)
-    #    return render('/casemanagement/phase.mako')
-
-    #@checkRole(('cm_ka'))
-    #def setPhaseAction(self):
-    #    validator = SetPhaseForm()
-    #    factory = CaseFactory()
-    #    c.form_errors = {}
-    #    c.form_result = {}
-    #    try:
-    #        try:
-    #            form_result = validator.to_python(request.params)
-    #            # Load case and do something on phase
-    #            case = factory.loadById(form_result.get('case_id'))
-
-    #            new_phase, new_phase_symbol = None, None
-
-    #            for new_phase_symbol in request.params.iterkeys():
-    #                try:
-    #                    new_phase = symbol_phase(new_phase_symbol)
-    #                    break
-    #                except KeyError:
-    #                    pass
-
-    #            if new_phase is None:
-    #                raise StandardError("Phase nicht gefunden.")
-
-    #            state = case.getState()
-
-    #            current_phase = state.getPhase()
-
-    #            #if not phase_neighbors(current_phase, new_phase):
-    #            #    raise StandardError("Phasen sind nicht benachbart.")
-
-    #            case_session = session.get('case')
-
-    #            #if case_session.isYoungerThan(INCONSISTENCY_CHECK_AFTER):
-    #            #    fields = case.getRequiredFields()
-    #            #    if not fields.isPhaseComplete(new_phase_symbol):
-    #            #        raise StandardError("Phase ist nicht komplett.")
-
-    #            state.setPhase(new_phase)
-
-    #            case_session.state = state
-    #            session.save()
-
-    #            # After setting the phase. Show print-dialog
-    #            c.success_for = SET_PHASE_NOTIFICATION_SUCCESS
-    #            c.success_text = SET_PHASE_NOTIFICATION_TEXT_SUCCESS
-    #            c.url_ok = h.url_for(controller='/case', action='phase',
-    #                                 id=case.id)
-
-    #            return render('/casemanagement/dialogs/success_set_phase.mako')
-    #        except formencode.Invalid, error:
-    #            c.form_result = error.value
-    #            c.form_errors = error.error_dict or {}
-    #            return self.phase(form_result.get('case_id'))
-    #    except:
-    #        return render('/tests/trace.mako')
-

Copied: wasko/branches/2.0/mpulsweb/controllers/phase.py (from rev 1734, wasko/branches/2.0/jmdweb/controllers/phase.py)
===================================================================
--- wasko/branches/2.0/jmdweb/controllers/phase.py	2010-02-24 10:46:42 UTC (rev 1734)
+++ wasko/branches/2.0/mpulsweb/controllers/phase.py	2010-02-24 10:57:21 UTC (rev 1738)
@@ -0,0 +1,116 @@
+# -*- coding: utf-8 -*-
+import logging
+
+from pylons import session, g, c
+
+from mpulsweb.lib.base import BaseController, h, render, request
+from mpulsweb.lib.security import checkRole
+from mpulsweb.model.phase import PhaseFactory
+
+
+SET_PHASE_NOTIFICATION_SUCCESS = u"""Phase gewechselt!"""
+SET_PHASE_NOTIFICATION_TEXT_SUCCESS= u"""\
+Die Phase konnte erfolgreich gewechselt werden. Bitte folgen Sie den
+aufgeführten Schritten, um zur Phasenübersicht fortzufahren."""
+
+log = logging.getLogger(__name__)
+
+class PhaseController(BaseController):
+
+    @checkRole(('admin_ka', 'cm_ka'))
+    def index(self, id):
+        return self.overview(id)
+
+    @checkRole(('admin_ka', 'cm_ka'))
+    def overview(self, id):
+        id = self._checkInt(id)
+        c.phases = PhaseFactory().load(id)
+        return render('/phase/phase.mako')
+
+    # Old methods from controllers.case.
+    # TODO: Reimplement these functions using the new libformed
+
+    #@checkRole(('admin_ka', 'cm_ka'))
+    #def phase(self, id):
+    #    id = self._checkInt(id)
+    #    case = self._loadCase(id)
+    #    phase = case.getState().getPhase()
+
+    #    # FIXME: the links generated by link are very likely wrong.
+    #    # They should point to formularpage/select.
+    #    link = lambda ti, extra = "": '"/case/show/%d/%s%s"' % (id, ti.key,
+    #                                                            extra)
+
+    #    rf = RequiredFields(g.formedTree)
+
+    #    navigation = self.getNavigation()
+
+    #    c.phase_pairs = rf.phases_pairs(phase, navigation, link)
+    #    c.current_phase = Phase(phase, True)
+
+    #    D = g.formedTree.getData
+    #    nbtr = int(D('nbtr'))
+    #    abbr = int(D('cm_end_art'))
+    #    c.nachbetreuung_geplant = nbtr not in [1,-1,-3] and abbr != 3
+
+    #    c.global_warnings = g.formedTree.linksToGlobalWarnings(id, navigation,
+    #                                                           link)
+    #    return render('/casemanagement/phase.mako')
+
+    #@checkRole(('cm_ka'))
+    #def setPhaseAction(self):
+    #    validator = SetPhaseForm()
+    #    factory = CaseFactory()
+    #    c.form_errors = {}
+    #    c.form_result = {}
+    #    try:
+    #        try:
+    #            form_result = validator.to_python(request.params)
+    #            # Load case and do something on phase
+    #            case = factory.loadById(form_result.get('case_id'))
+
+    #            new_phase, new_phase_symbol = None, None
+
+    #            for new_phase_symbol in request.params.iterkeys():
+    #                try:
+    #                    new_phase = symbol_phase(new_phase_symbol)
+    #                    break
+    #                except KeyError:
+    #                    pass
+
+    #            if new_phase is None:
+    #                raise StandardError("Phase nicht gefunden.")
+
+    #            state = case.getState()
+
+    #            current_phase = state.getPhase()
+
+    #            #if not phase_neighbors(current_phase, new_phase):
+    #            #    raise StandardError("Phasen sind nicht benachbart.")
+
+    #            case_session = session.get('case')
+
+    #            #if case_session.isYoungerThan(INCONSISTENCY_CHECK_AFTER):
+    #            #    fields = case.getRequiredFields()
+    #            #    if not fields.isPhaseComplete(new_phase_symbol):
+    #            #        raise StandardError("Phase ist nicht komplett.")
+
+    #            state.setPhase(new_phase)
+
+    #            case_session.state = state
+    #            session.save()
+
+    #            # After setting the phase. Show print-dialog
+    #            c.success_for = SET_PHASE_NOTIFICATION_SUCCESS
+    #            c.success_text = SET_PHASE_NOTIFICATION_TEXT_SUCCESS
+    #            c.url_ok = h.url_for(controller='/case', action='phase',
+    #                                 id=case.id)
+
+    #            return render('/casemanagement/dialogs/success_set_phase.mako')
+    #        except formencode.Invalid, error:
+    #            c.form_result = error.value
+    #            c.form_errors = error.error_dict or {}
+    #            return self.phase(form_result.get('case_id'))
+    #    except:
+    #        return render('/tests/trace.mako')
+


Property changes on: wasko/branches/2.0/mpulsweb/controllers/phase.py
___________________________________________________________________
Name: svn:mergeinfo
   + 



More information about the Mpuls-commits mailing list