Ignore:
Timestamp:
4 Nov 2016, 05:23:01 (8 years ago)
Author:
Henrik Bettermann
Message:

Catch Reportlab LayoutError.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py

    r13974 r14256  
    3030from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
    3131from waeup.kofa.image import KofaImageFile
     32from reportlab.platypus.doctemplate import LayoutError
    3233from waeup.kofa.imagestorage import DefaultFileStoreHandler
    3334from waeup.kofa.interfaces import (
     
    186187        except IOError:
    187188            return False, _('IOError: Application Slip could not be created.')
     189        except LayoutError, err:
     190            return False, _('Reportlab LayoutError: %s' % err)
    188191        # Add student
    189192        site = grok.getSite()
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r14110 r14256  
    3131from hurry.workflow.interfaces import (
    3232    IWorkflowInfo, IWorkflowState, InvalidTransitionError)
     33from reportlab.platypus.doctemplate import LayoutError
    3334from waeup.kofa.mandates.mandate import RefereeReportMandate
    3435from waeup.kofa.applicants.interfaces import (
     
    868869                _('Your image file is corrupted. '
    869870                  'Please replace.'), type='danger')
     871            return self.redirect(self.url(self.context))
     872        except LayoutError, err:
     873            view.flash(
     874                'PDF file could not be created. Reportlab error message: %s'
     875                % escape(err.message),
     876                type="danger")
    870877            return self.redirect(self.url(self.context))
    871878        self.response.setHeader(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r14213 r14256  
    2525from reportlab.lib.styles import getSampleStyleSheet
    2626from reportlab.platypus import Paragraph, Image, Table, Spacer
     27from reportlab.platypus.doctemplate import LayoutError
    2728from zope.event import notify
    2829from zope.schema.interfaces import ConstraintNotSatisfied
     
    800801            view.flash('Error in image file.')
    801802            return view.redirect(view.url(view.context))
     803        except LayoutError, err:
     804            view.flash(
     805                'PDF file could not be created. Reportlab error message: %s'
     806                % escape(err.message),
     807                type="danger")
     808            return view.redirect(view.url(view.context))
    802809        return pdf_stream
    803810
Note: See TracChangeset for help on using the changeset viewer.