Modify

Opened 3 years ago

Closed 3 years ago

Last modified 22 months ago

#8516 closed defect (fixed)

cannot upload attachment to a topic

Reported by: MasopustC Owned by: Blackhex
Priority: low Component: DiscussionPlugin
Severity: minor Keywords: Upload Attachment
Cc: Trac Release: 0.12

Description

uploading attachments to a existing topic leads to the following exception:

2011-02-18 09:07:30,789 Trac[api] DEBUG: SELECT i, d FROM topic WHERE id = 1
2011-02-18 09:07:30,792 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/attachment.py", line 448, in process_request
    self._do_save(req, attachment)
  File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/attachment.py", line 612, in _do_save
    if not resource_exists(self.env, parent_resource):
  File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/resource.py", line 454, in resource_exists
    return manager.resource_exists(resource)
  File "/usr/lib/python2.6/site-packages/TracDiscussion-0.8-py2.6.egg/tracdiscussion/api.py", line 232, in resource_exists
    values = (id,)) != None
  File "/usr/lib/python2.6/site-packages/TracDiscussion-0.8-py2.6.egg/tracdiscussion/api.py", line 1516, in _get_item
    context.cursor.execute(sql, values)
  File "/usr/lib/python2.6/site-packages/Trac-0.12.1-py2.6.egg/trac/db/util.py", line 65, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
ProgrammingError: column "i" does not exist
LINE 1: SELECT i, d FROM topic WHERE id = E'1'
               ^
ProgrammingError: column "i" does not exist
LINE 1: SELECT i, d FROM topic WHERE id = E'1'
               ^

checking the source i found the problem in api.py (sorry, am not a python programmer, but at least could fix it by applying the following patch:

diff -Naur discussionplugin/0.11/tracdiscussion/api.py discussionplugin-orig/0.11/tracdiscussion/api.py
--- discussionplugin/0.11/tracdiscussion/api.py 2011-02-18 09:23:59.144831970 +0100
+++ discussionplugin-orig/0.11/tracdiscussion/api.py    2011-01-30 18:25:52.000000000 +0100
@@ -223,17 +223,17 @@

         # Check if forum exists.
         if type == 'forum':
-            return self._get_item(context, 'forum', ('id',), where = 'id = %s',
+            return self._get_item(context, 'forum', ('id'), where = 'id = %s',
               values = (id,)) != None

         # Check if topic exits.
         elif type == 'topic':
-            return self._get_item(context, 'topic', ('id',), where = 'id = %s',
+            return self._get_item(context, 'topic', ('id'), where = 'id = %s',
               values = (id,)) != None

         # Check if message exists.
         elif type == 'message':
-            return self._get_item(context, 'message', ('id',), where = 'id = %s',
+            return self._get_item(context, 'message', ('id'), where = 'id = %s',
               values = (id,)) != None

     # Main request processing function.

br,
christian

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by Blackhex

  • Resolution set to fixed
  • Status changed from new to closed

Yeah, this is unfortunately the behavior of some Python versions. Thank you for reporting. It's already commited to the upstream.

comment:2 Changed 22 months ago by rjollos

Fixed in [9877].

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from Blackhex. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.