Opened 8 years ago
Closed 8 years ago
#12905 closed enhancement (fixed)
Make it easier to get file upload from request
| Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.3.3 |
| Component: | attachment | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: |
Added |
||
| Internal Changes: | |||
Description
Discussed starting in comment:9:ticket:11395.
Attachments (2)
Change History (7)
by , 8 years ago
| Attachment: | awesomeattachments.patch added |
|---|
comment:1 by , 8 years ago
comment:2 by , 8 years ago
3 things.
_normalized_filenamewould be removed fromtrac/attachment.py, however some plugins can use the method. At least, it is used from my private plugin.# Compatibility for Trac 1.2. Will be removed in 1.5.1. _normalized_filename = normalized_filename
- I don't consider we should raise an exception from
getfile(). Rejecting an empty file and no filename is just requirement ofAttachmentModule, is not requirement of another component. - It might be good to be
normalize_filenamerather thannormalized_filename.
comment:3 by , 8 years ago
I added the comment:2 suggestions. I'll also add some additional tests.
About the method naming, I'd prefer get_file and get_file_list to getfile and getfilelist, but wanted to remain consistent with existing method naming: getbool, getint, getfirst, getlist.
by , 8 years ago
| Attachment: | awesomeattachments.1.patch added |
|---|
comment:4 by , 8 years ago
Rebased and additional tests added: [cc9cace6a/rjollos.git]. Tests are currently running on hosted CI and I'll revise if any failures.
Revised refactoring of AwesomeAttachmentsPlugin in awesomeattachments.1.patch.
comment:5 by , 8 years ago
| API Changes: | modified (diff) |
|---|---|
| Resolution: | → fixed |
| Status: | assigned → closed |
Committed to trunk in r16304.



I thought it would be better to add a method to
_RequestArgs: log:rjollos.git:t12905_request_getfile.Refactoring of AwesomeAttachmentsPlugin in awesomeattachments.patch