[Mpuls-commits] r1031 - in wasko/branches/2.0: . waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jan 29 19:07:05 CET 2010


Author: bh
Date: 2010-01-29 19:07:01 +0100 (Fri, 29 Jan 2010)
New Revision: 1031

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/waskaweb/controllers/appointment.py
Log:
* waskaweb/controllers/appointment.py: Fix formatting.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-01-29 17:53:50 UTC (rev 1030)
+++ wasko/branches/2.0/ChangeLog	2010-01-29 18:07:01 UTC (rev 1031)
@@ -1,5 +1,9 @@
 2010-01-29  Bernhard Herzog  <bh at intevation.de>
 
+	* waskaweb/controllers/appointment.py: Fix formatting.
+
+2010-01-29  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/model/logbook.py (LogbookEntry.setByRow): Use
 	ensure_unicode to convert to unicode instead of hardcoding the
 	conversion inline.

Modified: wasko/branches/2.0/waskaweb/controllers/appointment.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/appointment.py	2010-01-29 17:53:50 UTC (rev 1030)
+++ wasko/branches/2.0/waskaweb/controllers/appointment.py	2010-01-29 18:07:01 UTC (rev 1031)
@@ -1,61 +1,76 @@
 # -*- coding: utf-8 -*-
 #
 # Copyright 2007, 2008 Intevation GmbH, Germany, <info at intevation.de>
-# 
-# This file is part of mpuls WASKA (CoMPUter-based case fiLeS - 
+#
+# This file is part of mpuls WASKA (CoMPUter-based case fiLeS -
 # Web-Anwendungs-Server fuer Kompetenzagenturen).
-# 
+#
 # mpuls WASKA is free software: you can redistribute it and/or modify it under
 # the terms of the GNU Affero General Public License as published by the
 # Free Software Foundation, either version 3 of the License, or (at your
 # option) any later version.
-# 
+#
 # mpuls WASKA is distributed in the hope that it will be useful, but WITHOUT
 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
 # License for more details.
-# 
+#
 # You should have received a copy of the GNU Affero General Public
 # License along with mpuls WASKA. If not, see <http://www.gnu.org/licenses/>.
-# 
-# mpuls WASKA has been developed on behalf of the 
+#
+# mpuls WASKA has been developed on behalf of the
 # Projekttraeger im Deutschen Zentrum fuer Luft- und Raumfahrt e.V. (PT-DLR)
 # within the programme Kompetenzagenturen (Durchfuehrungsphase) funded by
-# the Bundesministerium fuer Familie, Senioren, Frauen und Jugend and 
+# the Bundesministerium fuer Familie, Senioren, Frauen und Jugend and
 # European Social Fund resources.
 #
 # Authors:
 # Torsten Irländer <torsten.irlaender at intevation.de>
 # Sascha L. Teichmann <teichmann at intevation.de>
-#
+
 import logging
-import formencode
 from datetime import datetime
 
+import formencode
+
 from waskaweb.lib.base import *
-
 from waskaweb.lib.helpers import dd_mm_YYYY, HH_MM
-
 from waskaweb.lib.security import checkRole
 from waskaweb.lib.validators import CreateAppointmentForm
-from waskaweb.model.appointment import GlobalAppointmentOverview, GlobalAppointmentFactory
 
+from waskaweb.model.appointment import GlobalAppointmentOverview, \
+     GlobalAppointmentFactory
+
+
 log = logging.getLogger(__name__)
 
+
 DELETE_APPOINT_CONFIRM = u'Löschen Termin'
-DELETE_APPOINT_CONFIRM_TEXT = u'Wollen Sie wirklich den Termin löschen und die Daten unwiederbringlich verlieren?' 
+DELETE_APPOINT_CONFIRM_TEXT = u"""\
+Wollen Sie wirklich den Termin löschen und die Daten unwiederbringlich
+verlieren?"""
 DELETE_APPOINT_NOTIFICATION_SUCCESS = u'Termin gelöscht'
-DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS = u'''Der Termin wurde erfolgreich gelöscht. Klicken Sie auf 'OK', um zur Terminübersicht zu gelangen.''' 
+DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS = u"""\
+Der Termin wurde erfolgreich gelöscht. Klicken Sie auf 'OK', um zur
+Terminübersicht zu gelangen."""
 
 DELETE_APPOINT_NOTIFICATION_FAILED = u'Termin nicht gelöscht'
-DELETE_APPOINT_NOTIFICATION_TEXT_FAILED = u'''Bei dem Löschen des Termins ist einer Fehler aufgetreten. Der Termin wurde nicht gelöscht. Klicken Sie auf 'OK', um zur Terminübersicht zu gelangen.''' 
+DELETE_APPOINT_NOTIFICATION_TEXT_FAILED = u"""\
+Bei dem Löschen des Termins ist einer Fehler aufgetreten.  Der Termin
+wurde nicht gelöscht. Klicken Sie auf 'OK', um zur Terminübersicht zu
+gelangen."""
 
-CREATE_APPOINT_NOTIFICATION_SUCCESS = u'''Termin erstellt'''
-CREATE_APPOINT_NOTIFICATION_TEXT_SUCCESS = u'''Der Termin wurde erfolgreich erstellt. Klicken Sie auf 'OK', um zur Terminübersicht zu gelangen.'''
+CREATE_APPOINT_NOTIFICATION_SUCCESS = u"""Termin erstellt"""
+CREATE_APPOINT_NOTIFICATION_TEXT_SUCCESS = u"""\
+Der Termin wurde erfolgreich erstellt. Klicken Sie auf 'OK', um zur
+Terminübersicht zu gelangen."""
 
-EDIT_APPOINT_NOTIFICATION_SUCCESS = u'''Termin bearbeitet'''
-EDIT_APPOINT_NOTIFICATION_TEXT_SUCCESS = u'''Der Termin wurde erfolgreich bearbeitet. Klicken Sie auf 'OK', um zur Terminübersicht zu gelanden.'''
+EDIT_APPOINT_NOTIFICATION_SUCCESS = u"""Termin bearbeitet"""
+EDIT_APPOINT_NOTIFICATION_TEXT_SUCCESS = u"""\
+Der Termin wurde erfolgreich bearbeitet. Klicken Sie auf 'OK', um zur
+Terminübersicht zu gelanden."""
 
+
 class AppointmentController(BaseController):
 
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
@@ -72,11 +87,12 @@
         c.form_errors = {}
         c.form_result = {}
         cd = datetime.now()
-        c.form_defaults = {'start_date': dd_mm_YYYY(cd), \
-                        'start_time': HH_MM(cd), \
-                        'case_id': None}
+        c.form_defaults = {'start_date': dd_mm_YYYY(cd),
+                           'start_time': HH_MM(cd),
+                           'case_id': None}
         form = render('/appointments/new.mako')
-        return formencode.htmlfill.render(unicode(form, 'utf-8'),defaults=c.form_defaults)
+        return formencode.htmlfill.render(unicode(form, 'utf-8'),
+                                          defaults=c.form_defaults)
 
     @checkRole(('admin_ka'))
     def createAction(self):
@@ -91,18 +107,18 @@
                 appointment = factory.createNew()
                 appointment.setData(form_result)
                 appointment.store()
-                c.success_for   = CREATE_APPOINT_NOTIFICATION_SUCCESS
-                c.success_text  = CREATE_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok        = "/appointment/overview"
+                c.success_for = CREATE_APPOINT_NOTIFICATION_SUCCESS
+                c.success_text = CREATE_APPOINT_NOTIFICATION_TEXT_SUCCESS
+                c.url_ok = "/appointment/overview"
                 return render('/appointments/dialogs/success_create_appointment.mako')
             except formencode.Invalid, error:
                 c.form_result = error.value
                 c.form_errors = error.error_dict or {}
                 form = render('/appointments/new.mako')
-                return formencode.htmlfill.render(unicode(form, 'utf-8'), \
-                            defaults=c.form_result, \
-                            auto_insert_errors=False, \
-                            errors=c.form_errors)
+                return formencode.htmlfill.render(unicode(form, 'utf-8'),
+                                                  defaults=c.form_result,
+                                                  auto_insert_errors=False,
+                                                  errors=c.form_errors)
         except:
             return render('/tests/trace.mako')
 
@@ -118,20 +134,20 @@
         factory = GlobalAppointmentFactory()
         app = factory.loadById(id)
 
-        c.form_result = {'start_date'  : dd_mm_YYYY(app.start_date), \
-                         'start_time'  : HH_MM(app.start_date), \
-                         'end_date'    : dd_mm_YYYY(app.end_date), \
-                         'end_time'    : HH_MM(app.end_date), \
-                         'title'       : app.title, \
-                         'id'          : app.id, \
-                         'description' : app.description}
+        c.form_result = {'start_date': dd_mm_YYYY(app.start_date),
+                         'start_time': HH_MM(app.start_date),
+                         'end_date': dd_mm_YYYY(app.end_date),
+                         'end_time': HH_MM(app.end_date),
+                         'title': app.title,
+                         'id': app.id,
+                         'description': app.description}
 
         c.form_errors = {}
         form = render('/appointments/edit.mako')
-        return formencode.htmlfill.render(unicode(form, 'utf-8'), \
-                defaults=c.form_result, \
-                auto_insert_errors=False, \
-                errors=c.form_errors)
+        return formencode.htmlfill.render(unicode(form, 'utf-8'),
+                                          defaults=c.form_result,
+                                          auto_insert_errors=False,
+                                          errors=c.form_errors)
 
     @checkRole(('admin_ka'))
     def editAction(self):
@@ -146,18 +162,18 @@
                 appointment = factory.loadById(form_result.get('id'))
                 appointment.setData(form_result)
                 appointment.store()
-                c.success_for   = EDIT_APPOINT_NOTIFICATION_SUCCESS
-                c.success_text  = EDIT_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok        = "/appointment/overview"
+                c.success_for = EDIT_APPOINT_NOTIFICATION_SUCCESS
+                c.success_text = EDIT_APPOINT_NOTIFICATION_TEXT_SUCCESS
+                c.url_ok = "/appointment/overview"
                 return render('/appointments/dialogs/success_edit_appointment.mako')
             except formencode.Invalid, error:
                 c.form_result = error.value
                 c.form_errors = error.error_dict or {}
                 form = render('/appointments/edit.mako')
-                return formencode.htmlfill.render(unicode(form, 'utf-8'), \
-                            defaults=c.form_result, \
-                            auto_insert_errors=False, \
-                            errors=c.form_errors)
+                return formencode.htmlfill.render(unicode(form, 'utf-8'),
+                                                  defaults=c.form_result,
+                                                  auto_insert_errors=False,
+                                                  errors=c.form_errors)
         except:
             return render('/tests/trace.mako')
 
@@ -169,21 +185,21 @@
         if confirmed == 1:
             appointment = factory.loadById(id)
             if appointment.delete():
-                c.success_for  = DELETE_APPOINT_NOTIFICATION_SUCCESS
+                c.success_for = DELETE_APPOINT_NOTIFICATION_SUCCESS
                 c.success_text = DELETE_APPOINT_NOTIFICATION_TEXT_SUCCESS
-                c.url_ok       = "/appointment/overview"
+                c.url_ok = "/appointment/overview"
                 return render('/appointments/dialogs/success_delete_appointment.mako')
             else:
-                c.failed_for  = DELETE_APPOINT_NOTIFICATION_FAILED
+                c.failed_for = DELETE_APPOINT_NOTIFICATION_FAILED
                 c.failed_text = DELETE_APPOINT_NOTIFICATION_TEXT_FAILED
-                c.url_ok      = "/appointment/overview"
+                c.url_ok = "/appointment/overview"
                 return render('/appointments/dialogs/failed_delete_appointment.mako')
         else:
-            c.context     = "../main.mako" 
+            c.context = "../main.mako"
             c.confirm_for = DELETE_APPOINT_CONFIRM
-            c.question    = DELETE_APPOINT_CONFIRM_TEXT
-            c.url_yes     = "/appointment/delete/%s/1" % id
-            c.url_no      = "/appointment/overview/"
+            c.question = DELETE_APPOINT_CONFIRM_TEXT
+            c.url_yes = "/appointment/delete/%s/1" % id
+            c.url_no = "/appointment/overview/"
             return render('/appointments/dialogs/confirm.mako')
 
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))



More information about the Mpuls-commits mailing list