[Mpuls-commits] r5063 - in base/trunk: . mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jun 3 12:15:25 CEST 2011


Author: ludwig
Date: 2011-06-03 12:15:24 +0200 (Fri, 03 Jun 2011)
New Revision: 5063

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/logbook.py
   base/trunk/mpulsweb/controllers/news.py
   base/trunk/mpulsweb/controllers/repeatgroup.py
   base/trunk/mpulsweb/controllers/settings.py
   base/trunk/mpulsweb/controllers/usersettings.py
Log:
Issue1005: Move translated msgs inline.
(logbook.py repeatgroup.py usersettings.py settings.py news.py)

Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2011-06-03 10:00:28 UTC (rev 5062)
+++ base/trunk/ChangeLog	2011-06-03 10:15:24 UTC (rev 5063)
@@ -1,5 +1,14 @@
 2011-06-03  Ludwig Reiter <ludwig.reiter at intevation.de>
 
+	* mpulsweb/controllers/logbook.py,
+	mpulsweb/controllers/repeatgroup.py,
+	mpulsweb/controllers/usersettings.py,
+	mpulsweb/controllers/settings.py,
+	mpulsweb/controllers/news.py:
+	Issue1005: Move translated msgs inline.
+
+2011-06-03  Ludwig Reiter <ludwig.reiter at intevation.de>
+
 	* mpulsweb/controllers/evaluation_overview.py,
 	mpulsweb/controllers/document.py:
 	Issue1005: Move translated msgs inline.

Modified: base/trunk/mpulsweb/controllers/logbook.py
===================================================================
--- base/trunk/mpulsweb/controllers/logbook.py	2011-06-03 10:00:28 UTC (rev 5062)
+++ base/trunk/mpulsweb/controllers/logbook.py	2011-06-03 10:15:24 UTC (rev 5063)
@@ -41,31 +41,6 @@
 from mpulsweb.lib.base import BaseController, c, render, request, session
 from mpulsweb.lib.validators import CreateLogbookForm, EditLogbookForm
 
-LOGBOOK_ENTRY_CREATE_FAILED       = _(u"Logbook entry was not created!")
-LOGBOOK_ENTRY_CREATE_FAILED_TEXT  = _(u"An error occured while creating a logbook entry")
-
-CREATE_LOGBOOK_ENTRY_SUCCESS      = _(u"Entry successfully created.")
-CREATE_LOGBOOK_ENTRY_SUCCESS_TEXT = _(u"The logbook entry was sucessfully created")
-
-DELETE_LOGBOOK_ENTRY_CONFIRM      = _(u"Delete logbook entry?")
-DELETE_LOGBOOK_ENTRY_CONFIRM_TEXT = _(u"""Do you want to delete this logbook entry?
-The data will be irrevocably lost.""")
-
-LOGBOOK_ENTRY_DELETE_SUCCESS      = _(u"Logbook entry successfully deleted!")
-LOGBOOK_ENTRY_DELETE_SUCCESS_TEXT = _(u"Logbook entry was successfully deleted!")
-
-LOGBOOK_ENTRY_DELETE_FAILED       = _(u"Deletion of logbook entry failed!")
-LOGBOOK_ENTRY_DELETE_FAILED_TEXT  = _(u"An error occured while deleting the logbook entry.")
-
-LOGBOOK_ENTRY_SHOW_FAILED         = _(u"Showing of logbook entry failed!")
-LOGBOOK_ENTRY_SHOW_FAILED_TEXT    = _(u"An error occured while showing the logbook entry.")
-
-LOGBOOK_ENTRY_SAVE_SUCCESS        = _(u"Changes on logbook successfull!")
-LOGBOOK_ENTRY_SAVE_SUCCESS_TEXT   = _(u"The changes on the logbook entry were applied successfully.")
-
-LOGBOOK_ENTRY_SAVE_FAILED         = _(u"Changes on logbook failed!")
-LOGBOOK_ENTRY_SAVE_FAILED_TEXT    = _(u"An error occured applying changes on the logbook entry")
-
 log = logging.getLogger(__name__)
 
 def get_sort(params):
@@ -101,8 +76,8 @@
             entry = LogbookEntry()
             entry.loadById(id)
         except Exception, e:
-            c.failed_for = LOGBOOK_ENTRY_SHOW_FAILED
-            c.failed_text = LOGBOOK_ENTRY_SHOW_FAILED_TEXT
+            c.failed_for = _(u"Showing of logbook entry failed!")
+            c.failed_text =  _(u"An error occured while showing the logbook entry.")
             c.url_ok = url_for(controller='/logbook', action='index',
                                id=session['case'].id)
             log.exception(e)
@@ -167,13 +142,13 @@
             logbook.store(session['USER_AUTHORIZED'].id)
             c.url_ok = url_for(controller='/logbook', action='index',
                                id=session['case'].id)
-            c.success_for = CREATE_LOGBOOK_ENTRY_SUCCESS
-            c.success_text = CREATE_LOGBOOK_ENTRY_SUCCESS_TEXT
+            c.success_for = _(u"Entry successfully created.")
+            c.success_text = _(u"The logbook entry was sucessfully created")
             return render('/logbook/dialogs/success_create_logbook_entry.mako')
         except:
             traceback.print_exc(file=sys.stderr)
-            c.failed_for = LOGBOOK_ENTRY_CREATE_FAILED
-            c.failed_text = LOGBOOK_ENTRY_CREATE_FAILED_TEXT
+            c.failed_for = _(u"Logbook entry was not created!")
+            c.failed_text = _(u"An error occured while creating a logbook entry")
             c.url_ok = url_for(controller='/case', action='logbook',
                                id=session['case'].id)
             return render('/logbook/dialogs/failed_create_logbook_entry.mako')
@@ -203,8 +178,8 @@
                                               errors={})
         except Exception, e:
             log.exception(e)
-            c.failed_for = LOGBOOK_ENTRY_SHOW_FAILED
-            c.failed_text = LOGBOOK_ENTRY_SHOW_FAILED_TEXT
+            c.failed_for =  _(u"Showing of logbook entry failed!")
+            c.failed_text = _(u"An error occured while showing the logbook entry.")
             c.url_ok = url_for(controller='/logbook', action='index',
                                id=session['case'].id)
             return render('/logbook/dialogs/failed_show_logbook_entry.mako')
@@ -238,15 +213,15 @@
             entry.setId(id)
             entry.storeForUser(session['USER_AUTHORIZED'].id)
 
-            c.success_for = LOGBOOK_ENTRY_SAVE_SUCCESS
-            c.success_text = LOGBOOK_ENTRY_SAVE_SUCCESS_TEXT
+            c.success_for = _(u"Changes on logbook successfull!")
+            c.success_text = _(u"The changes on the logbook entry were applied successfully.")
             c.url_ok = url_for(controller='/logbook', action='index',
                                id=session['case'].id)
             return render('/logbook/dialogs/success_save_logbook_entry.mako')
         except Exception, e:
             log.exception(e)
-            c.failed_for = LOGBOOK_ENTRY_SAVE_FAILED
-            c.failed_text = LOGBOOK_ENTRY_SAVE_FAILED_TEXT
+            c.failed_for = _(u"Changes on logbook failed!")
+            c.failed_text = _(u"An error occured applying changes on the logbook entry")
             c.url_ok = url_for(controller='/logbook', action='index',
                                id=session['case'].id)
             return render('/logbook/dialogs/failed_save_logbook_entry.mako')
@@ -258,21 +233,22 @@
         if confirmed == 1:
             try:
                 Logbook().deleteEntryById(int(id))
-                c.success_for = LOGBOOK_ENTRY_DELETE_SUCCESS
-                c.success_text = LOGBOOK_ENTRY_DELETE_SUCCESS_TEXT
+                c.success_for = _(u"Logbook entry successfully deleted!")
+                c.success_text = _(u"Logbook entry was successfully deleted!")
                 c.url_ok = url_for(controller='logbook', action='index',
                                    id=session['case'].id)
                 return render('/logbook/dialogs/success_delete_logbook_entry.mako')
             except Exception, e:
                 log.exception(e)
-                c.failed_for = LOGBOOK_ENTRY_DELETE_FAILED
-                c.failed_text = LOGBOOK_ENTRY_DELETE_FAILED_TEXT
+                c.failed_for = _(u"Deletion of logbook entry failed!")
+                c.failed_text = _(u"An error occured while deleting the logbook entry.")
                 c.url_ok = url_for(controller='/logbook', action='index',
                                    id=session['case'].id)
                 return render('/logbook/dialogs/failed_delete_logbook_entry.mako')
         else:
-            c.confirm_for = DELETE_LOGBOOK_ENTRY_CONFIRM
-            c.question = DELETE_LOGBOOK_ENTRY_CONFIRM_TEXT
+            c.confirm_for = _(u"Delete logbook entry?")
+            c.question = _(u"""Do you want to delete this logbook entry?
+The data will be irrevocably lost.""")
             c.url_yes = url_for(controller='/logbook', action='delete', id=id,
                                 confirmed=1)
             c.url_no = url_for(controller='/logbook', action='index',

Modified: base/trunk/mpulsweb/controllers/news.py
===================================================================
--- base/trunk/mpulsweb/controllers/news.py	2011-06-03 10:00:28 UTC (rev 5062)
+++ base/trunk/mpulsweb/controllers/news.py	2011-06-03 10:15:24 UTC (rev 5063)
@@ -14,10 +14,6 @@
 log = logging.getLogger(__name__)
 
 
-MARK_NEWS_AS_READ_CONFIRM      = _(u"Mark message as read")
-MARK_NEWS_AS_READ_CONFIRM_TEXT = _(u"""Do you really want to mark the message as read?
-It will permanently disappear from the overview.""")
-
 class NewsController(BaseController):
 
     def hide(self, id, confirmed=0):
@@ -33,8 +29,9 @@
             user.setNewsAsRead(id)
             redirect_to(controller='/')
         else:
-            c.dialog_title = MARK_NEWS_AS_READ_CONFIRM
-            c.dialog_text = MARK_NEWS_AS_READ_CONFIRM_TEXT
+            c.dialog_title = _(u"Mark message as read")
+            c.dialog_text = _(u"""Do you really want to mark the message as read?
+It will permanently disappear from the overview.""")
             c.url_yes = url_for(controller='/news', action='hide', id=id,
                                 confirmed=1)
             c.url_no = url_for("/")

Modified: base/trunk/mpulsweb/controllers/repeatgroup.py
===================================================================
--- base/trunk/mpulsweb/controllers/repeatgroup.py	2011-06-03 10:00:28 UTC (rev 5062)
+++ base/trunk/mpulsweb/controllers/repeatgroup.py	2011-06-03 10:15:24 UTC (rev 5063)
@@ -17,10 +17,6 @@
 log = logging.getLogger(__name__)
 
 
-DELETE_RG_ENTRY_CONFIRM      = _(u"Delete dataset?")
-DELETE_RG_ENTRY_CONFIRM_TEXT = _(u"""Do you want to delete this dataset and
-irrevocably lose the data?""")
-
 class RepeatgroupController(BaseController):
 
     def list(self, id):
@@ -63,8 +59,9 @@
             return FormularpageController().select(session.get('navigation'
                                                                '.selectedpage'))
         else:
-            c.confirm_for = DELETE_RG_ENTRY_CONFIRM
-            c.question = DELETE_RG_ENTRY_CONFIRM_TEXT
+            c.confirm_for = _(u"Delete dataset?")
+            c.question = _(u"""Do you want to delete this dataset and
+irrevocably lose the data?""")
             c.url_yes = h.url_for(controller='/repeatgroup', action='delete',
                                   id=id, confirmed=1)
             c.url_no = h.url_for(controller='/formularpage', action='select',

Modified: base/trunk/mpulsweb/controllers/settings.py
===================================================================
--- base/trunk/mpulsweb/controllers/settings.py	2011-06-03 10:00:28 UTC (rev 5062)
+++ base/trunk/mpulsweb/controllers/settings.py	2011-06-03 10:15:24 UTC (rev 5063)
@@ -15,10 +15,6 @@
 log = logging.getLogger(__name__)
 
 
-EDIT_AGENCY_SUCCESS_HEADER = _('Configurations saved!')
-EDIT_AGENCY_SUCCESS_TEXT = _('Please click on ok to continue.')
-
-
 class SettingsController(BaseController):
 
     @checkRole('admin_ka')
@@ -58,8 +54,8 @@
                                               errors=c.form_errors)
 
         c.agency.store(c.form_result)
-        c.dialog_title = EDIT_AGENCY_SUCCESS_HEADER
-        c.dialog_text = EDIT_AGENCY_SUCCESS_TEXT
+        c.dialog_title = _('Configurations saved!')
+        c.dialog_text = _('Please click on ok to continue.')
         c.url_ok = url_for(controller='/settings')
         return render ('/settings/dialogs/success_edit.mako')
 

Modified: base/trunk/mpulsweb/controllers/usersettings.py
===================================================================
--- base/trunk/mpulsweb/controllers/usersettings.py	2011-06-03 10:00:28 UTC (rev 5062)
+++ base/trunk/mpulsweb/controllers/usersettings.py	2011-06-03 10:15:24 UTC (rev 5063)
@@ -45,13 +45,7 @@
 
 log = logging.getLogger(__name__)
 
-SET_PASSWORD_NOTIFICATION_HEADER = _(u"User password changed!")
-SET_PASSWORD_NOTIFICATION_TEXT   = _(u"You password was successfully changed") + " " + _("Please click OK to continue.")
 
-EDIT_STANDIN_SUCCESS_HEADER = _('Standin saved!')
-EDIT_STANDIN_SUCCESS_TEXT   = _('Your standin is saved. Please click on ok to continue.')
-
-
 class UsersettingsController(BaseController):
 
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr', 'pb_ka'))
@@ -93,8 +87,9 @@
                 user.password = new_pass
                 session['USER_AUTHORIZED'] = user
                 session.save()
-                c.dialog_title = SET_PASSWORD_NOTIFICATION_HEADER
-                c.dialog_text = SET_PASSWORD_NOTIFICATION_TEXT
+                c.dialog_title = _(u"User password changed!")
+                c.dialog_text = _(u"You password was successfully changed") + \
+                        " " + _("Please click OK to continue.")
                 c.url_ok = h.url_for(controller="usersettings",
                                      action="showSettings", id=user.id)
             else:
@@ -127,8 +122,9 @@
                 session_user.needs_passrefresh = False
                 session['USER_AUTHORIZED'] = session_user
                 session.save()
-                c.dialog_title = SET_PASSWORD_NOTIFICATION_HEADER
-                c.dialog_text = SET_PASSWORD_NOTIFICATION_TEXT
+                c.dialog_title = _(u"User password changed!")
+                c.dialog_text = _(u"You password was successfully changed") + \
+                        " " + _("Please click OK to continue.")
                 c.url_ok = h.url_for(controller="usersettings",
                                      action="showSettings",
                                      id=session_user.id)
@@ -168,8 +164,8 @@
             c.form_result = error.value
             c.form_errors = error.error_dict or {}
             return render('usersettings/edit_standin.mako')
-        c.dialog_title = EDIT_STANDIN_SUCCESS_HEADER
-        c.dialog_text = EDIT_STANDIN_SUCCESS_TEXT
+        c.dialog_title = _('Standin saved!')
+        c.dialog_text =  _('Your standin is saved. Please click on ok to continue.')
         uid = c.form_result.get('uid')
         c.url_ok = h.url_for(controller='/usersettings', action='showSettings',
                              id=uid)



More information about the Mpuls-commits mailing list