Modify

Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#8516 closed defect (fixed)

cannot upload attachment to a topic

Reported by: Christian Masopust Owned by: Radek Bartoň
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 13 years ago by Radek Bartoň

Resolution: fixed
Status: newclosed

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

comment:2 Changed 12 years ago by Ryan J Ollos

Fixed in [9877].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Radek Bartoň.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.