#12539 closed defect (fixed)
AwesomeAttachmentsPlugin does not work with 1.0.6
Reported by: | wbeaucha | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | AwesomeAttachmentsPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description
Installed and enabled AwesomeAttachmentsPlugin on 1.0.6.post2, running on windows 2008. The new dialog at the bottom of the new ticket page shows up and lets you choose files to attach, but when the ticket is submitted the files are not uploaded. Viewing the ticket shows 0 attachments.
Attachments (0)
Change History (42)
comment:1 Changed 9 years ago by
Owner: | set to Ryan J Ollos |
---|---|
Status: | new → accepted |
comment:2 Changed 9 years ago by
Yes, I tried adding: trac.ticket.web_ui.TicketModule = disabled but when I did that the "New Ticket" menu button disappeared and when I clicked view tickets I got an error message.
comment:3 Changed 9 years ago by
Did you copy the [components]
section from AwesomeAttachmentsPlugin#Installation? I just noticed a typo, fixed in AwesomeAttachmentsPlugin@18.
comment:4 follow-up: 6 Changed 9 years ago by
Yes, I copied the [components]
section from the install page. I re-added it after your typo fix and now the attachments add fine.
One other issue is that when I attach an image, AwesomeAttachmentsPlugin automatically adds the image code to the description field, but the syntax is wrong. It adds:
[[Image(C:\fakepath\my_image.png)]]
when it should be:
[[Image(my_image.png)]]
Thank you!
comment:6 Changed 9 years ago by
Replying to wbeaucha:
One other issue is that when I attach an image, AwesomeAttachmentsPlugin automatically adds the image code to the description field, but the syntax is wrong.
Yeah, I can reproduce that issue. I'll take a look.
Would you kindly test out the changes in [14919] and report back? Thanks!
comment:7 Changed 9 years ago by
You'll need to re-enable trac.ticket.web_ui.TicketModule
after updating to [14919].
comment:9 Changed 9 years ago by
#7044 is the only open issue for this plugin, and I feel that it's fairly minor in Trac 1.0 and later. If your testing of the plugin goes well, then I'll tag version 0.3.
comment:10 Changed 9 years ago by
Btw, I must give credit for the implementation in [14919] to jun66j5. I used the patch trac:attachment:ticket:11377:tracadvsearchplugin.diff as guidance in implementing the changes.
comment:11 Changed 9 years ago by
Documentation updated in AwesomeAttachmentsPlugin@19 and AwesomeAttachmentsPlugin@20.
comment:12 follow-up: 13 Changed 9 years ago by
I downloaded the latest packet from AwesomeAttachmentsPlugin, installed it using "easy_install ." and restarted trac. I removed the line that disabled trac.ticket.web_ui.TicketModule
.
When I enable the AwesomeAttachmentsPlugin plugin from web admin, it adds:
awesome.awesomeattachments.awesomeattachments = enabled
.
I created a ticket and added an attachment. I no longer see the "I have files to attach to this ticket" checkbox. I see that the Image macro code has been updated to [[Image(my_image.png)]]
.
The attachment does not get added.
comment:13 Changed 9 years ago by
Replying to wbeaucha:
The attachment does not get added.
I'm not able to reproduce. Could you set the log level to debug (TracTroubleshooting#ChecktheLogs) and look at the output? Here is what I see:
09:20:29 Trac[main] DEBUG: Dispatching <RequestWithSession "POST '/newticket'"> 09:20:29 Trac[api] WARNING: Unable to find repository '(default)' for synchronization 09:20:29 Trac[session] DEBUG: Retrieving session for ID '68b69fb027e096641b75d671' 09:20:29 Trac[attachment] INFO: New attachment: ticket:22: trac_logo.png by anonymous 127.0.0.1 - - [14/Oct/2015 09:20:29] "POST /newticket HTTP/1.1" 303 - 09:20:30 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/ticket/22'"> 09:20:30 Trac[api] WARNING: Unable to find repository '(default)' for synchronization 09:20:30 Trac[session] DEBUG: Retrieving session for ID '68b69fb027e096641b75d671' 09:20:30 Trac[default_workflow] DEBUG: render_ticket_action_control: action "leave" 09:20:30 Trac[default_workflow] DEBUG: render_ticket_action_control: action "resolve" 09:20:30 Trac[default_workflow] DEBUG: render_ticket_action_control: action "reassign" 09:20:30 Trac[default_workflow] DEBUG: render_ticket_action_control: action "accept" 09:20:30 Trac[chrome] DEBUG: Prepare chrome data for request 09:20:30 Trac[formatter] DEBUG: Executing Wiki macro Image by provider <trac.wiki.macros.ImageMacro object at 0x109750950> 127.0.0.1 - - [14/Oct/2015 09:20:30] "GET /ticket/22 HTTP/1.1" 200 - 09:20:30 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/raw-attachment/ticket/22/trac_logo.png'"> 09:20:30 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/chrome/site/your_project_logo.png'"> 09:20:30 Trac[api] WARNING: Unable to find repository '(default)' for synchronization 09:20:30 Trac[chrome] WARNING: File your_project_logo.png not found in any of ['/Users/rjollos/ticket12529/trac/htdocs'] 09:20:30 Trac[main] WARNING: [127.0.0.1] HTTPNotFound: 404 Not Found (File your_project_logo.png not found) 09:20:30 Trac[chrome] DEBUG: Prepare chrome data for request 09:20:30 Trac[session] DEBUG: Retrieving session for ID '68b69fb027e096641b75d671' 09:20:30 Trac[session] DEBUG: Retrieving session for ID '68b69fb027e096641b75d671' 09:20:30 Trac[attachment] DEBUG: Trying to open attachment at /Users/rjollos/ticket12529/trac/files/attachments/ticket/12c/12c6fc06c99a462375eeb3f43dfd832b08ca9e17/b0ceaa97b9745847ef52045f7146a042e65ba944.png 09:20:30 Trac[chrome] DEBUG: Prepare chrome data for request 127.0.0.1 - - [14/Oct/2015 09:20:30] "GET /raw-attachment/ticket/22/trac_logo.png HTTP/1.1" 200 - 127.0.0.1 - - [14/Oct/2015 09:20:30] "GET /chrome/site/your_project_logo.png HTTP/1.1" 404 -
comment:14 Changed 9 years ago by
Here's the log:
2015-10-14 12:27:34,229 Trac[main] DEBUG: Dispatching <RequestWithSession "POST '/newticket'"> 2015-10-14 12:27:34,229 Trac[api] WARNING: Unable to find repository '(default)' for synchronization 2015-10-14 12:27:34,244 Trac[session] DEBUG: Retrieving session for ID u'tracadmin' 2015-10-14 12:27:34,651 Trac[default_workflow] DEBUG: render_ticket_action_control: action "leave" 2015-10-14 12:27:34,651 Trac[default_workflow] DEBUG: render_ticket_action_control: action "resolve" 2015-10-14 12:27:34,651 Trac[default_workflow] DEBUG: render_ticket_action_control: action "reassign" 2015-10-14 12:27:34,667 Trac[default_workflow] DEBUG: render_ticket_action_control: action "accept" 2015-10-14 12:27:34,808 Trac[formatter] DEBUG: Executing Wiki macro Image by provider <trac.wiki.macros.ImageMacro object at 0x02CBBA30> 2015-10-14 12:27:34,869 Trac[notification] INFO: Sending notification through SMTP at mail.comfin.ge.com:25 to [u'mail.addrress@zzz.com'] 2015-10-14 12:27:36,151 Trac[main] DEBUG: Dispatching <RequestWithSession "POST '/newticket'"> 2015-10-14 12:27:36,151 Trac[api] WARNING: Unable to find repository '(default)' for synchronization 2015-10-14 12:27:36,151 Trac[session] DEBUG: Retrieving session for ID u'tracadmin' 2015-10-14 12:27:36,197 Trac[chrome] DEBUG: Prepare chrome data for request 2015-10-14 12:27:37,338 Trac[main] DEBUG: Dispatching <RequestWithSession "GET '/ticket/66'"> 2015-10-14 12:27:37,338 Trac[api] WARNING: Unable to find repository '(default)' for synchronization 2015-10-14 12:27:37,338 Trac[session] DEBUG: Retrieving session for ID u'tracadmin' 2015-10-14 12:27:37,683 Trac[formatter] DEBUG: Executing Wiki macro Image by provider <trac.wiki.macros.ImageMacro object at 0x02CBBA30> 2015-10-14 12:27:37,697 Trac[default_workflow] DEBUG: render_ticket_action_control: action "leave" 2015-10-14 12:27:37,697 Trac[default_workflow] DEBUG: render_ticket_action_control: action "resolve" 2015-10-14 12:27:37,697 Trac[default_workflow] DEBUG: render_ticket_action_control: action "reassign" 2015-10-14 12:27:37,713 Trac[default_workflow] DEBUG: render_ticket_action_control: action "accept" 2015-10-14 12:27:37,760 Trac[chrome] DEBUG: Prepare chrome data for request 2015-10-14 12:27:40,072 Trac[formatter] DEBUG: Executing Wiki macro Image by provider <trac.wiki.macros.ImageMacro object at 0x02CBBA30>
comment:15 follow-up: 16 Changed 9 years ago by
It looks like in our environment the path /chrome/awesome/js/awesome.js is not a valid URL path. It should be /trac/chrome/awesome/js/awesome.js . Does that need to be a relative path rather than absolute?
Thanks again
comment:16 Changed 9 years ago by
Replying to wbeaucha:
It looks like in our environment the path /chrome/awesome/js/awesome.js is not a valid URL path. It should be /trac/chrome/awesome/js/awesome.js . Does that need to be a relative path rather than absolute?
That's an application-relative path, so the value shown is okay. Did you do a hard-refresh of your browser to clear the cached version of awesome.js
? For the Chrome browser: SHIFT + F5 on Windows or CMD + R on Mac.
comment:25 Changed 9 years ago by
I downloaded the latest, installed it, restarted trac and tried it with both Chrome and Firefox but still cannot get it to add the attachment. No errors but the ticket shows 0 attachments. I also verified that if I disable AwesomeAttachmentsPlugin I can still add an an attachment.
comment:26 Changed 9 years ago by
If you don't see the I have files to attach to this ticket then it seems certain that awesome.js
is loading, but just to be sure, could you view the source for the page and verify that you can follow a link to awesome.js
?
Do you have any other plugins installed?
comment:27 Changed 9 years ago by
I have files to attach to this ticket is not displayed, and I can go to the URL and view the js with no issues. Apparently I have trac 1.09 installed, not 1.06 as mentioned previously. I do have a bunch of other plugins installed, but I created a trac.ini with only the following loaded to test and had the same results:
acct_mgr.admin.* = enabled acct_mgr.api.* = enabled acct_mgr.db.sessionstore = disabled acct_mgr.htfile.htdigeststore = enabled acct_mgr.http.* = disabled acct_mgr.notification.* = enabled acct_mgr.pwhash.* = enabled acct_mgr.pwhash.htdigesthashmethod = enabled acct_mgr.register.* = enabled acct_mgr.svnserve.svnservepasswordstore = disabled acct_mgr.web_ui.* = enabled acct_mgr.web_ui.resetpwstore = disabled awesomeattachments.* = enabled awesome.awesomeattachments.awesomeattachments = enabled
comment:28 Changed 9 years ago by
Okay, reproduced. The issue occurs with the environment name contained in the path. I had been running tracd
with the -s
switch, which strips the environment name from the path. Investigating a fix ...
comment:31 Changed 9 years ago by
That did it! Awesome.
Thanks again, this will make the users happy!
comment:32 Changed 9 years ago by
Thanks for the fast reply. I'm happy to close this one! Actually, considering now whether we can integrate this into Trac without too much effort.
comment:34 Changed 9 years ago by
One thing to be aware of is that attachment manipulators are not called when inserting attachments from the /newticket
page: awesomeattachmentsplugin/tags/awesomeattachments-0.3/awesome/awesomeattachments.py@:74#L74. To see this, compare to browser:tags/trac-1.0.9/trac/attachment.py@:744-754#L718. I might fix the issue, but first I'll look further into the possibility of integrating the equivalent of this plugin to Trac.
comment:35 Changed 9 years ago by
Replying to rjollos:
In 14927:
I don't think we intend to use TicketModule.ticket_path_re
to search ticket's id from URL. The variable is for applying to req.path_info
. Instead, I think we should declare own variable for this.
-
awesomeattachmentsplugin/trunk/awesome/awesomeattachments.py
diff --git a/awesomeattachmentsplugin/trunk/awesome/awesomeattachments.py b/awesomeattachmentsplugin/trunk/awesome/awesomeattachment index 88d0cba..66bf04a 100644
a b import unicodedata 14 14 15 15 from trac.attachment import Attachment 16 16 from trac.core import Component, TracError, implements 17 from trac.ticket.web_ui import TicketModule18 17 from trac.util import get_reporter_id 19 18 from trac.util.text import stripws 20 from trac.util.translation import _ , tag_19 from trac.util.translation import _ 21 20 from trac.web.api import IRequestFilter 22 21 from trac.web.chrome import ITemplateProvider, add_link, add_script 23 22 … … class AwesomeAttachments(Component): 61 60 62 61 # Private methods 63 62 63 _ticket_path_re = re.compile(r'/newticket/([0-9]+)$') 64 64 65 def _add_attachments(self, req, url, permanent): 65 match = TicketModule.ticket_path_re.search(url)66 match = self._ticket_path_re.search(url) 66 67 if match: 67 68 tid = match.group(1) 68 69 attachments = req.args.getlist('attachment[]')
Another considering, I think req.path_info.rstrip() == '/newticket'
is redundant. We could simplify it with req.path_info == '/newticket'
. See trac:source:/tags/trac-1.0.9/trac/ticket/web_ui.py@:175#L170.
-
awesomeattachmentsplugin/trunk/awesome/awesomeattachments.py
diff --git a/awesomeattachmentsplugin/trunk/awesome/awesomeattachments.py b/awesomeattachmentsplugin/trunk/awesome/awesomeattachment index 88d0cba..7821df2 100644
a b class AwesomeAttachments(Component): 29 28 # IRequestFilter methods 30 29 31 30 def pre_process_request(self, req, handler): 32 if req.path_info .rstrip()== '/newticket' and 'submit' in req.args:31 if req.path_info == '/newticket' and 'submit' in req.args: 33 32 req.add_redirect_listener(self._add_attachments) 34 33 req.args.pop('attachment', None) 35 34 return handler 36 35 37 36 def post_process_request(self, req, template, data, content_type): 38 if template == 'ticket.html' and \ 39 req.path_info.rstrip() == '/newticket': 37 if template == 'ticket.html' and req.path_info == '/newticket': 40 38 add_script(req, 'awesome/js/awesome.js') 41 39 add_link(req, 'image', 42 40 req.href.chrome('awesome/images/add.png'),
comment:36 follow-up: 42 Changed 9 years ago by
Good points. Feel free to push any improvements, I don't plan to maintain this. I'd like to spend time adding equivalent features to Trac (comment:34), but not sure when I'll have time for that. Basic feature like this plugin, and TracDragDropPlugin as well, are really needed in Trac to keep pace with what users expect these days.
comment:42 Changed 9 years ago by
Replying to rjollos:
I'd like to spend time adding equivalent features to Trac (comment:34), but not sure when I'll have time for that.
Summary of issues that need to be fixed and areas that would need to be improved if this plugin was added to Trac:
- Issue: Attachment manipulators are not called.
- Issue: Data is lost on page reload due to preview, back navigation or validator failure (#7044).
- Rather than inserting the
[[Image]]
macro when selecting a file or when the edit description button is pressed, dragging an attachment link to an input text area should insert the[[Image]]
macro. - Styling of add/remove buttons is poor.
- Functionality is needed not just for the
/newticket
page, but also when adding attachments through the attach file form.
Of course we might consider an entirely different approach than what was implemented for this plugin.
Did you disable
trac.ticket.web_ui.TicketModule
? See AwesomeAttachmentsPlugin#Installation.