[Mpuls-commits] r3445 - in base/trunk: . mpulsweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Aug 24 19:46:13 CEST 2010
Author: bh
Date: 2010-08-24 19:46:12 +0200 (Tue, 24 Aug 2010)
New Revision: 3445
Modified:
base/trunk/ChangeLog
base/trunk/mpulsweb/controllers/case_bundle.py
Log:
* mpulsweb/controllers/case_bundle.py: Fix formatting. Move some
more strings into the methods.
Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog 2010-08-24 10:08:49 UTC (rev 3444)
+++ base/trunk/ChangeLog 2010-08-24 17:46:12 UTC (rev 3445)
@@ -1,3 +1,8 @@
+2010-08-24 Bernhard Herzog <bh at intevation.de>
+
+ * mpulsweb/controllers/case_bundle.py: Fix formatting. Move some
+ more strings into the methods.
+
2010-08-18 Bernhard Herzog <bh at intevation.de>
* mpulsweb/i18n/mpulsweb.pot: Regenerated.
Modified: base/trunk/mpulsweb/controllers/case_bundle.py
===================================================================
--- base/trunk/mpulsweb/controllers/case_bundle.py 2010-08-24 10:08:49 UTC (rev 3444)
+++ base/trunk/mpulsweb/controllers/case_bundle.py 2010-08-24 17:46:12 UTC (rev 3445)
@@ -6,10 +6,10 @@
import paste
from pylons import app_globals as g
-from mpulsweb.lib.translation import _, ungettext
from formed.meta.data import PageNode
+from mpulsweb.lib.translation import _, ungettext
from mpulsweb.lib.base import c, render, request, session, BaseController
from mpulsweb.lib.helpers import url_for
from mpulsweb.lib.security import checkRole
@@ -37,10 +37,7 @@
OK_TO_CONTINUE = _("Please click OK to continue.")
-DIALOG_CONFIRM_EXPORT_EXPLAINATION = u'''%s'''
-TRANSFER_SUCCESS_HEADER = _(u"Editor appointed!")
-STANDIN_SUCCESS_HEADER = _(u"Stand-in appointed!")
class CaseBundleController(BaseController):
@@ -56,8 +53,8 @@
log.debug(form_result)
# Check if the user has selected any cases
- if len(form_result.get('case_id', [])) <= 0 and \
- not form_result.get('all_cases'):
+ if (len(form_result.get('case_id', [])) <= 0
+ and not form_result.get('all_cases')):
return self._empty_caselist()
# Build case bundle
@@ -271,27 +268,24 @@
case_bundle = session.get('casebundle')
if confirmed == 1:
num = case_bundle.markDelete()
- MARKDELETE_SUCCESS_HEADER = ungettext(u"Case deleted!",
- u"Cases deleted!",
- num)
- MARKDELETE_SUCCESS_TEXT = ungettext(u"%s case was sucessfully cleared for deletion.",
- u"%s cases were sucessfully cleared for deletion.",
- num) + " " + OK_TO_CONTINUE
- c.dialog_title = MARKDELETE_SUCCESS_HEADER
- c.dialog_text = MARKDELETE_SUCCESS_TEXT % str(num)
+ c.dialog_title = ungettext(u"Case deleted!", u"Cases deleted!", num)
+ c.dialog_text = (ungettext(u"%s case was sucessfully cleared for"
+ u" deletion.",
+ u"%s cases were sucessfully cleared for"
+ u" deletion.", num) % num
+ + " " + OK_TO_CONTINUE)
c.url_ok = url_for(controller='/case_overview')
del session['casebundle']
return render ('/casebundle/dialogs/success_markdelete.mako')
else:
c.context = "../main.mako"
- DIALOG_CONFIRM_DELETE = ungettext(u'Delete case?',
- u'Delete cases?',
- len(case_bundle.getCases()))
- DIALOG_CONFIRM_EXPLAINATION = ungettext('Do you really want to delete the following case?%s',
- 'Do you really want to delete the following cases?%s',
- len(case_bundle.getCases()))
- c.dialog_title = DIALOG_CONFIRM_DELETE
- c.dialog_text = (DIALOG_CONFIRM_EXPLAINATION
+ c.dialog_title = ungettext(u'Delete case?', u'Delete cases?',
+ len(case_bundle.getCases()))
+ c.dialog_text = (ungettext('Do you really want to delete the'
+ ' following case?%s',
+ 'Do you really want to delete the'
+ ' following cases?%s',
+ len(case_bundle.getCases()))
% "\n".join(self._buildCaseList(case_bundle)))
c.url_yes = url_for(controller='/case_bundle', action='markDelete',
confirmed=1)
@@ -305,28 +299,24 @@
case_bundle = session.get('casebundle')
if confirmed == 1:
num = case_bundle.delete()
- DELETE_SUCCESS_HEADER = ungettext(u"Case sucessfully deleted.",
- u"Cases sucessfully deleted.",
- num)
-
- DELETE_SUCCESS_TEXT = ungettext(u"%s case was sucessfully deleted.",
- u"%s cases were sucessfully deleted.",
- num) + " " + OK_TO_CONTINUE
-
- c.dialog_title = DELETE_SUCCESS_HEADER
- c.dialog_text = DELETE_SUCCESS_TEXT % str(num)
+ c.dialog_title = ungettext(u"Case sucessfully deleted.",
+ u"Cases sucessfully deleted.",
+ num)
+ c.dialog_text = (ungettext(u"%s case was sucessfully deleted.",
+ u"%s cases were sucessfully deleted.",
+ num) % num
+ + " " + OK_TO_CONTINUE)
c.url_ok = url_for(controller='/case_overview')
del session['casebundle']
return render('/casebundle/dialogs/success_delete_admin.mako')
else:
- DIALOG_CONFIRM_DELETE = ungettext(u'Delete case?',
- u'Delete cases?',
- len(case_bundle.getCases()))
- DIALOG_CONFIRM_EXPLAINATION = ungettext('Do you really want to delete the following case?%s',
- 'Do you really want to delete the following cases?%s',
- len(case_bundle.getCases()))
- c.dialog_title = DIALOG_CONFIRM_DELETE
- c.dialog_text = (DIALOG_CONFIRM_EXPLAINATION
+ c.dialog_title = ungettext(u'Delete case?', u'Delete cases?',
+ len(case_bundle.getCases()))
+ c.dialog_text = (ungettext('Do you really want to delete the'
+ ' following case?%s',
+ 'Do you really want to delete the'
+ ' following cases?%s',
+ len(case_bundle.getCases()))
% "\n".join(self._buildCaseList(case_bundle)))
c.url_yes = url_for(controller='/case_bundle', action='delete',
confirmed=1)
@@ -341,36 +331,39 @@
case_bundle = session.get('casebundle')
if confirmed == 1:
num = case_bundle.markAnonymize()
- MARKANONYMIZE_SUCCESS_HEADER = ungettext(u"Case successfully cleared for anonymisation!",
- u"Cases successfully cleared for anonymisation!",
- num)
- MARKANONYMIZE_SUCCESS_TEXT = ungettext(u"""%s case was cleared for anonymisation. It will be presented to the administrators
-for review for the definite anonymisation.""",
-u"""%s cases were cleared for anonymisation. They will be presented to the administrators
-for review for the definite anonymisation.""", num) + " " + OK_TO_CONTINUE
-
- c.success_for = MARKANONYMIZE_SUCCESS_HEADER
- c.success_text = MARKANONYMIZE_SUCCESS_TEXT % str(num)
+ c.success_for = ungettext(u"Case successfully cleared for"
+ u" anonymisation!",
+ u"Cases successfully cleared for"
+ u" anonymisation!",
+ num)
+ c.success_text = (
+ ungettext(u"%s case was cleared for anonymisation. It will be"
+ u" presented to the administrators for review for"
+ u" the definite anonymisation.",
+ u"%s cases were cleared for anonymisation. They will"
+ u" be presented to the administrators for review for"
+ u" the definite anonymisation.", num) % num
+ + " " + OK_TO_CONTINUE)
c.url_ok = url_for(controller='/case_overview')
del session['casebundle']
return render ('/casebundle/dialogs/success_anonymize.mako')
else:
- DIALOG_CONFIRM_MARKANONYMIZE = ungettext(u'Clear case for anonymisation?',
- u'Clear cases for anonymisation?',
- len(case_bundle.getCases()))
-
- DIALOG_CONFIRM_MARKANONYMIZE_EXPLAINATION = ungettext(u'''Do you
-really want to clear the following case for anonymisation? The case will not be
-available to you to work on it and it will be presented to the administrators
-for review for the definite anonymisation.%s''',
- u'''Do you really want to clear the following cases for anonymisation? The cases will not be
-available to you to work on them and they will be presented to the administrators
-for review for the definite anonymisation.%s''',
- len(case_bundle.getCases()))
-
- c.dialog_title = DIALOG_CONFIRM_MARKANONYMIZE
- c.dialog_text = (DIALOG_CONFIRM_MARKANONYMIZE_EXPLAINATION
- % "\n".join(self._buildCaseList(case_bundle)))
+ c.dialog_title = ungettext(u'Clear case for anonymisation?',
+ u'Clear cases for anonymisation?',
+ len(case_bundle.getCases()))
+ c.dialog_text = (
+ ungettext(u"Do you really want to clear the following case for"
+ u" anonymisation? The case will not be available to"
+ u" you to work on it and it will be presented to the"
+ u" administrators for review for the definite"
+ u" anonymisation.%s",
+ u"Do you really want to clear the following cases for"
+ u" anonymisation? The cases will not be available to"
+ u" you to work on them and they will be presented to"
+ u" the administrators for review for the definite"
+ u" anonymisation.%s",
+ len(case_bundle.getCases()))
+ % "\n".join(self._buildCaseList(case_bundle)))
c.url_yes = url_for(controller='/case_bundle',
action='markAnonymize', confirmed=1)
c.url_no = url_for(controller='/case_overview')
@@ -383,34 +376,32 @@
case_bundle = session.get('casebundle')
if confirmed == 1:
num = case_bundle.anonymize()
- ANONYMIZE_SUCCESS_HEADER = ungettext(u"Case anonymised!",
- u"Cases anonymised!",
- num)
-
- ANONYMIZE_SUCCESS_TEXT = ungettext(u"%s case was sucessfully anonymised.",
- u"%s cases were sucessfully anonymised.",
- num) + " " + OK_TO_CONTINUE
-
- c.dialog_text = ANONYMIZE_SUCCESS_TEXT % str(num)
- c.dialog_title = ANONYMIZE_SUCCESS_HEADER
+ c.dialog_title = ungettext(u"Case anonymised!",
+ u"Cases anonymised!",
+ num)
+ c.dialog_text = (ungettext(u"%s case was sucessfully anonymised.",
+ u"%s cases were sucessfully anonymised.",
+ num) % str(num)
+ + " " + OK_TO_CONTINUE)
c.url_ok = url_for(controller='/case_overview')
del session['casebundle']
return render ('/casebundle/dialogs/success_anonymize.mako')
else:
- DIALOG_CONFIRM_ANONYMIZE = ungettext(u'Anonymise case?',
- u'Anonymise cases?',
- len(case_bundle.getCases()))
- DIALOG_CONFIRM_ANONYMIZE_EXPLAINATION = ungettext(u"""Do you really want to anonymise the case
- and irrevocably lose its personal data? The case will not be available to editing anymore.
- The anonymised case will still be considered in the analysis.%s""",
- u"""Do you really want to anonymise the cases
- and irrevocably lose the personal data? The cases will not be available to editing anymore.
- The anonymised cases will still be considered in the analysis.%s""",
- len(case_bundle.getCases()))
-
- c.dialog_title = DIALOG_CONFIRM_ANONYMIZE
- c.dialog_text = (DIALOG_CONFIRM_ANONYMIZE_EXPLAINATION
- % "\n".join(self._buildCaseList(case_bundle)))
+ c.dialog_title = ungettext(u'Anonymise case?', u'Anonymise cases?',
+ len(case_bundle.getCases()))
+ c.dialog_text = (
+ ungettext(u"Do you really want to anonymise the case and"
+ u" irrevocably lose its personal data? The case"
+ u" will not be available to editing anymore."
+ u" The anonymised case will still be considered"
+ u" in the analysis.%s",
+ u"Do you really want to anonymise the cases and"
+ u" irrevocably lose the personal data? The cases"
+ u" will not be available to editing anymore."
+ u" The anonymised cases will still be considered"
+ u" in the analysis.%s",
+ len(case_bundle.getCases()))
+ % "\n".join(self._buildCaseList(case_bundle)))
c.url_yes = url_for(controller='/case_bundle', action='anonymize',
confirmed=1)
c.url_no = url_for(controller='/case_overview')
@@ -424,28 +415,24 @@
case_bundle = session.get('casebundle')
if confirmed == 1:
num = case_bundle.restore()
- RESTORE_SUCCESS_HEADER = ungettext(u"Case restored!",
- u"Cases restored!",
- num)
- RESTORE_SUCCESS_TEXT = ungettext(u"%s was successfully restored.",
- u"%s were successfully restored.",
- num) + " " + OK_TO_CONTINUE
- c.dialog_title = RESTORE_SUCCESS_HEADER
- c.dialog_text = RESTORE_SUCCESS_TEXT % str(num)
+ c.dialog_title = ungettext(u"Case restored!", u"Cases restored!",
+ num)
+ c.dialog_text = ungettext(u"%s was successfully restored.",
+ u"%s were successfully restored.",
+ num) % num + " " + OK_TO_CONTINUE
c.url_ok = url_for(controller='/case_overview')
del session['casebundle']
return render ('/casemanagement/dialogs/success_restore.mako')
else:
- DIALOG_CONFIRM_RESTORE = ungettext(u'Restore case?',
- u'Restore cases?',
- len(case_bundle.getCases()))
- DIALOG_CONFIRM_RESTORE_EXPLAINATION = ungettext(u'Do you really want to restore the following case? It will be available again to editing.%s',
- u'Do you really want to restore the following cases? They will be available again to editing.%s',
- len(case_bundle.getCases()))
-
- c.dialog_title = DIALOG_CONFIRM_RESTORE
- c.dialog_text = (DIALOG_CONFIRM_RESTORE_EXPLAINATION
- % "\n".join(self._buildCaseList(case_bundle)))
+ c.dialog_title = ungettext(u'Restore case?', u'Restore cases?',
+ len(case_bundle.getCases()))
+ c.dialog_text = (
+ ungettext(u'Do you really want to restore the following case?'
+ u' It will be available again to editing.%s',
+ u'Do you really want to restore the following cases?'
+ u' They will be available again to editing.%s',
+ len(case_bundle.getCases()))
+ % "\n".join(self._buildCaseList(case_bundle)))
c.url_yes = url_for(controller='/case_bundle', action='restore',
confirmed=1)
c.url_no = url_for(controller='/case_overview')
@@ -461,12 +448,12 @@
form_result = validator.to_python(request.params)
num = case_bundle.setEditor(form_result.get('editor'))
user = UserObject(form_result.get('editor'))
- c.dialog_title = TRANSFER_SUCCESS_HEADER
- TRANSFER_SUCCESS_TEXT = ungettext(u"%s case was successfully transferred to %s %s",
- u"%s cases were successfully transferred to %s %s",
- num) + " " + OK_TO_CONTINUE
- c.dialog_text= (TRANSFER_SUCCESS_TEXT
- % (str(num), user.first_name, user.last_name))
+ c.dialog_title = _(u"Editor appointed!")
+ c.dialog_text= (
+ ungettext(u"%s case was successfully transferred to %s %s",
+ u"%s cases were successfully transferred to %s %s",
+ num) % (num, user.first_name, user.last_name)
+ + " " + OK_TO_CONTINUE)
c.url_ok = url_for(controller='/case_overview')
del session['casebundle']
return render('/casebundle/dialogs/success_editor.mako')
@@ -483,11 +470,12 @@
try:
form_result = validator.to_python(request.params)
num = case_bundle.setStandin(form_result.get('standin'))
- c.dialog_title = STANDIN_SUCCESS_HEADER
- STANDIN_SUCCESS_TEXT = ungettext(u"%s case was sucessfully assigend to a substitute.",
- u"%s cases were sucessfully assigend to a substitute.",
- num) + " " + OK_TO_CONTINUE
- c.dialog_text = STANDIN_SUCCESS_TEXT % str(num)
+ c.dialog_title = _(u"Stand-in appointed!")
+ c.dialog_text = (
+ ungettext(u"%s case was sucessfully assigend to a substitute.",
+ u"%s cases were sucessfully assigend to a"
+ u" substitute.",
+ num) % num + " " + OK_TO_CONTINUE)
c.url_ok = url_for(controller='/case_overview')
del session['casebundle']
return render('/casebundle/dialogs/success_standin.mako')
@@ -500,15 +488,13 @@
def export(self, type="XML"):
c.context = "../main.mako"
case_bundle = session.get('casebundle')
- data = {'exporttype': type,
+ data = {'exporttype': type,
'exportanonym': '1',
- 'exportselection': [i.getName() for i in g.formedTree.findAllByClass(PageNode)]}
- DIALOG_CONFIRM_EXPORT = ungettext(u'Export case?',
- u'Export cases?',
- len(case_bundle.getCases()))
- c.dialog_title = DIALOG_CONFIRM_EXPORT
- c.dialog_text = (DIALOG_CONFIRM_EXPORT_EXPLAINATION
- % "\n".join(self._buildCaseList(case_bundle)))
+ 'exportselection':
+ [i.getName() for i in g.formedTree.findAllByClass(PageNode)]}
+ c.dialog_title = ungettext(u'Export case?', u'Export cases?',
+ len(case_bundle.getCases()))
+ c.dialog_text = "\n".join(self._buildCaseList(case_bundle))
form = render('/casemanagement/dialogs/confirm_export.mako')
return formencode.htmlfill.render(form, defaults=data,
auto_insert_errors=False,
More information about the Mpuls-commits
mailing list