[Mpuls-commits] r1573 - in wasko/branches/2.0: . waskaweb/controllers
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Feb 15 19:38:31 CET 2010
Author: bh
Date: 2010-02-15 19:38:28 +0100 (Mon, 15 Feb 2010)
New Revision: 1573
Modified:
wasko/branches/2.0/ChangeLog
wasko/branches/2.0/waskaweb/controllers/casedocument.py
Log:
* waskaweb/controllers/casedocument.py: Fix formatting.
Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog 2010-02-15 17:35:23 UTC (rev 1572)
+++ wasko/branches/2.0/ChangeLog 2010-02-15 18:38:28 UTC (rev 1573)
@@ -1,5 +1,9 @@
2010-02-15 Bernhard Herzog <bh at intevation.de>
+ * waskaweb/controllers/casedocument.py: Fix formatting.
+
+2010-02-15 Bernhard Herzog <bh at intevation.de>
+
* waskaweb/controllers/caseappointment.py: Remove unused imports
2010-02-15 Bernhard Herzog <bh at intevation.de>
Modified: wasko/branches/2.0/waskaweb/controllers/casedocument.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/casedocument.py 2010-02-15 17:35:23 UTC (rev 1572)
+++ wasko/branches/2.0/waskaweb/controllers/casedocument.py 2010-02-15 18:38:28 UTC (rev 1573)
@@ -6,24 +6,35 @@
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to
-from waskaweb.lib.base import BaseController, render
from mpulsweb.lib.security import checkRole
import mpulsweb.lib.helpers as h
from mpulsweb.model.document import Document, deleteDocument
+
+from waskaweb.lib.base import BaseController, render
from waskaweb.model.case import CaseFactory, LoadCaseNotExistsError
+
log = logging.getLogger(__name__)
-SET_ATTACHMENT_SUCCESS_HEADER = u"""Anlage hinzugefügt!"""
-SET_ATTACHMENT_SUCCESS_TEXT = u"""Bitte klicken Sie auf "OK", um fortzufahren."""
-SET_ATTACHMENT_FAILED_HEADER = u"""Keine Anlage hinzugefügt!"""
-SET_ATTACHMENT_FAILED_TEXT = u"""Vergewissern Sie sich, ob der angegebene Pfad korrekt ist. Anlagen können direkt über den "Browse" bzw. "Durchsuchen" Button ausgewählt werden. Bitte klicken Sie auf "OK", um fortzufahren."""
-SET_ATTACHMENT_SUCCESS_DELETE_HEADER = u"""Anlage gelöscht!"""
-SET_ATTACHMENT_SUCCESS_DELETE_TEXT = u"""Bitte klicken Sie auf "OK", um fortzufahren."""
-SET_ATTACHMENT_CONFIRM_DELETE_HEADER = u"""Anlage löschen?"""
-SET_ATTACHMENT_CONFIRM_DELETE_TEXT = u"""Wollen Sie die Anlage wirklich löschen und die Daten unwiederbringlich verlieren?"""
+SET_ATTACHMENT_SUCCESS_HEADER = u"""Anlage hinzugefügt!"""
+SET_ATTACHMENT_SUCCESS_TEXT = u"""\
+Bitte klicken Sie auf "OK", um fortzufahren."""
+SET_ATTACHMENT_FAILED_HEADER = u"""Keine Anlage hinzugefügt!"""
+SET_ATTACHMENT_FAILED_TEXT = u"""\
+Vergewissern Sie sich, ob der angegebene Pfad korrekt ist. Anlagen können
+direkt über den "Browse" bzw. "Durchsuchen" Button ausgewählt werden.
+Bitte klicken Sie auf "OK", um fortzufahren."""
+SET_ATTACHMENT_SUCCESS_DELETE_HEADER = u"""Anlage gelöscht!"""
+SET_ATTACHMENT_SUCCESS_DELETE_TEXT = u"""\
+Bitte klicken Sie auf "OK", um fortzufahren."""
+SET_ATTACHMENT_CONFIRM_DELETE_HEADER = u"""Anlage löschen?"""
+SET_ATTACHMENT_CONFIRM_DELETE_TEXT = u"""\
+Wollen Sie die Anlage wirklich löschen und die Daten unwiederbringlich
+verlieren?"""
+
+
def loadCase(id):
factory = CaseFactory()
try:
@@ -31,6 +42,7 @@
except LoadCaseNotExistsError, err:
self.showError()
+
class CasedocumentController(BaseController):
@checkRole(('admin_ka', 'cm_ka'))
@@ -53,7 +65,7 @@
try:
case = int(request.POST['case'])
except:
- redirect_to(controller="casedocument", action="index")
+ redirect_to(controller="casedocument", action="index")
try:
doc = Document()
@@ -64,17 +76,21 @@
doc.create(myfile.filename, myfile.file, case)
c.success_for = SET_ATTACHMENT_SUCCESS_HEADER
c.success_text = SET_ATTACHMENT_SUCCESS_TEXT
- c.url_ok = h.url_for(controller="/casedocument", action="index", id=case)
+ c.url_ok = h.url_for(controller="/casedocument",
+ action="index", id=case)
return render('/documents/dialogs/success_attachment.mako')
finally:
if not myfile is None:
- try: myfile.file.close()
- except: pass
+ try:
+ myfile.file.close()
+ except:
+ pass
except Exception, e:
log.exception(e)
c.failed_for = SET_ATTACHMENT_FAILED_HEADER
c.failed_text = SET_ATTACHMENT_FAILED_TEXT
- c.url_ok = h.url_for(controller="/casedocument", action="new", id=case)
+ c.url_ok = h.url_for(controller="/casedocument",
+ action="new", id=case)
return render('/documents/dialogs/failed_attachment.mako')
@checkRole(('admin_ka', 'cm_ka'))
@@ -83,37 +99,35 @@
try:
document = Document(id)
document.load(True)
- data = paste.fileapp.DataApp(
- document.data,
- content_type=document.mime,
- cache_control='must-revalidate',
- pragma='public')
+ data = paste.fileapp.DataApp(document.data,
+ content_type=document.mime,
+ cache_control='must-revalidate',
+ pragma='public')
return data(request.environ, self.start_response)
except Exception, e:
log.exception(e)
- redirect_to(controller="case", action="documents")
+ redirect_to(controller="case", action="documents")
@checkRole('cm_ka')
def delete(self, id, confirmed):
- id = self._checkInt(id)
+ id = self._checkInt(id)
confirmed = self._checkBool(confirmed)
if confirmed == 1:
try:
deleteDocument(id, True)
except Exception, e:
log.exception(e)
- c.url_ok = h.url_for(controller="/casedocument",
- action="index" ,
- id=session['case'].id)
- c.success_for = SET_ATTACHMENT_SUCCESS_DELETE_HEADER
- c.success_text = SET_ATTACHMENT_SUCCESS_DELETE_TEXT
- return render('/casemanagement/dialogs/delete_attachment_success.mako',
+ c.url_ok = h.url_for(controller="/casedocument", action="index" ,
+ id=session['case'].id)
+ c.success_for = SET_ATTACHMENT_SUCCESS_DELETE_HEADER
+ c.success_text = SET_ATTACHMENT_SUCCESS_DELETE_TEXT
+ return render('/casemanagement/dialogs/delete_attachment_success.mako',
id=session['case'].id)
else:
- c.context = "../main.mako"
+ c.context = "../main.mako"
c.confirm_for = SET_ATTACHMENT_CONFIRM_DELETE_HEADER
- c.question = SET_ATTACHMENT_CONFIRM_DELETE_TEXT
- c.url_yes = "/casedocument/delete/%d/1" % (id)
- c.url_no = h.url_for(controller="/casedocument", action="index",
- id=session['case'].id)
+ c.question = SET_ATTACHMENT_CONFIRM_DELETE_TEXT
+ c.url_yes = "/casedocument/delete/%d/1" % (id)
+ c.url_no = h.url_for(controller="/casedocument", action="index",
+ id=session['case'].id)
return render('/casemanagement/dialogs/confirm_delete_attachment.mako')
More information about the Mpuls-commits
mailing list