# 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
|
|
| 43 | 43 | from trac.util.translation import _, tag_ |
| 44 | 44 | from trac.web import HTTPBadRequest, IRequestHandler |
| 45 | 45 | from trac.web.chrome import add_link, add_stylesheet, add_ctxtnav, \ |
| 46 | | INavigationContributor |
| | 46 | INavigationContributor |
| 47 | 47 | from trac.web.href import Href |
| 48 | 48 | from trac.wiki.api import IWikiSyntaxProvider |
| 49 | 49 | from trac.wiki.formatter import format_to |
| … |
… |
|
| 668 | 668 | attachment.ipnr = req.remote_addr |
| 669 | 669 | |
| 670 | 670 | # Validate attachment |
| | 671 | |
| 671 | 672 | for manipulator in self.manipulators: |
| 672 | 673 | for field, message in manipulator.validate_attachment(req, |
| 673 | 674 | attachment): |
| | 675 | |
| 674 | 676 | if field: |
| 675 | | raise InvalidAttachment( |
| | 677 | |
| 676 | 678 | _('Attachment field %(field)s is invalid: %(message)s', |
| 677 | 679 | field=field, message=message)) |
| 678 | 680 | else: |
| 679 | | raise InvalidAttachment( |
| | 681 | |
| 680 | 682 | _('Invalid attachment: %(message)s', message=message)) |
| | 683 | |
| | 684 | |
| | 685 | |
| 681 | 686 | |
| 682 | 687 | if req.args.get('replace'): |
| 683 | 688 | try: |