Edgewall Software

Ticket #10353: show_attachment_manipulator_error.3.diff

File show_attachment_manipulator_error.3.diff, 1.8 KB (added by scott_wang@…, 14 years ago)
  • trac/attachment.py

    # HG changeset patch
    # User scott_wang
    # Date 1321771949 -28800
    # Branch 0.12-stable
    # Node ID 80be6b6d32a36f4e9ac071b08691a4ccb62b8a32
    # Parent  260a71f3b9d83b27a72d0de6a6d879e90842edd2
    show all error messages from IAttachmentManipulator.validate_attachment to fix #10353
    
    diff -r 260a71f3b9d8 -r 80be6b6d32a3 trac/attachment.py
    a b  
    4343from trac.util.translation import _, tag_
    4444from trac.web import HTTPBadRequest, IRequestHandler
    4545from trac.web.chrome import add_link, add_stylesheet, add_ctxtnav, \
    46                             INavigationContributor
     46                            INavigationContributor
    4747from trac.web.href import Href
    4848from trac.wiki.api import IWikiSyntaxProvider
    4949from trac.wiki.formatter import format_to
     
    668668        attachment.ipnr = req.remote_addr
    669669
    670670        # Validate attachment
     671
    671672        for manipulator in self.manipulators:
    672673            for field, message in manipulator.validate_attachment(req,
    673674                                                                  attachment):
     675
    674676                if field:
    675                     raise InvalidAttachment(
     677                   
    676678                        _('Attachment field %(field)s is invalid: %(message)s',
    677679                          field=field, message=message))
    678680                else:
    679                     raise InvalidAttachment(
     681                   
    680682                        _('Invalid attachment: %(message)s', message=message))
     683
     684
     685
    681686
    682687        if req.args.get('replace'):
    683688            try: