Modify ↓
#12269 closed defect (fixed)
Error occurs when used with MySQL
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Component: | WikiTableMacro |
Severity: | critical | Keywords: | SQLTable MySQL |
Cc: | Trac Release: | 1.0 |
Description
I am using Trac (version 1.1.5dev) and SQLTable Macro (latest version [14524]) with MySQL Database.
When I use macro, 'long' object has no attribute 'fetchall'
Error occurs.
It seems to be due to cursor.execute
function used in the file table.py
/ function expand_macro
:
- sqlite3.cursor.execute returns cursor
- MySQLdb.cursor.execute returns a number of rows
(https://www.python.org/dev/peps/pep-0249/#id15 page notes "Return values are not defined.")
Simple patch below have fixed the issue.
-
wikitable/table.py
58 58 try: 59 59 with self.env.db_query as db: 60 60 cursor = db.cursor() 61 rows = cursor.execute(content).fetchall() 61 cursor.execute(content) 62 rows = cursor.fetchall() 62 63 cols = get_column_names(cursor) 63 64 except self.env.db_exc.DatabaseError, e: 64 65 return system_message(_("Invalid SQL"), exception_to_unicode(e))
Attachments (0)
Change History (3)
comment:1 Changed 10 years ago by
comment:3 Changed 10 years ago by
Owner: | changed from Ryan J Ollos to theYT <dev@…> |
---|
Note: See
TracTickets for help on using
tickets.
Thank you for the patch. I've seen the issue before so I should have known better. I'll commit the change today.