#8372 closed defect (duplicate)
[PATCH] Inability to add/delete attachments to wiki pages
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | attachment | Version: | 0.11-stable |
| Severity: | major | Keywords: | attachment action CGI parse |
| Cc: | vjt@… | Branch: | |
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
Howdy,
today I stumbled upon on a rather strange problem with the attachment module, as it was ignoring POST requests that create new attachments on wiki pages, thus making impossible to add or remove them. I searched on the open issues here and found nothing relevant.
So, after much testing, tcpdumping, log inspection, etc, I started adding self.env.log.debug() statements to identify where the execution flow was interrupted, and I found that the action CGI parameter is incorrectly parsed somewhere, because instead of referencing a str containing the action name, it contains a list of 2 identical str objects containing the action name. e.g.:
2009-06-10 21:19:57,386 Trac[attachment] DEBUG: action: [u'delete', u'delete']
The following patch fixes the issue, I don't know if it's a correct solution, but in the meantime it works on my installation; I'm quite sure that this problem should be corrected elsewhere. I'm no python expert, but sailing through the Trac sources was fun :).
--- attachment.py~ 2009-06-10 21:30:47.000000000 +0200
+++ attachment.py 2009-06-10 21:30:40.000000000 +0200
@@ -367,6 +367,9 @@
parent_realm = Resource(parent_realm)
action = req.args.get('action', 'view')
+ if action.__class__ == list:
+ action = action[0]
+
if action == 'new':
parent_id = path.rstrip('/')
else:
I'm running 0.11-stable via WSGI using Python 2.6 and Apache 2.2.11 on an Ubuntu 9.04 installation on AMD64 hardware.
Cheers, and thanks for developing Trac and releasing it as OSS :).
~Marcello
Attachments (0)
Change History (2)
comment:1 by , 16 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
comment:2 by , 16 years ago
Shame on me, I checked out the wrong revision from subversion. Updated to 0.11.4 and everything works.
Many thanks for your support.
~Marcello



That was an issue with Python 2.6 that was fixed quite some time ago (see #7876, fixed in [7774] and released in 0.11.3). You should update your install.