Modify ↓
#14388 closed defect (fixed)
Refactor for Python 3?
| Reported by: | Rob Hills | Owned by: | Rob Hills |
|---|---|---|---|
| Priority: | normal | Component: | TracSqlHelperScript |
| Severity: | normal | Keywords: | |
| Cc: | Trac Release: | 1.6 |
Description
Exception thrown when called from Trac Hours plugin init...
2025-07-03 21:24:54,482 Trac[loader] ERROR: Skipping "trachours.setup = trachours.db":
Traceback (most recent call last):
File "/usr/lib/python3.11/cmd.py", line 214, in onecmd
func = getattr(self, 'do_' + cmd)
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TracAdmin' object has no attribute 'do_upgrade'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/webapps/dev.tracker.wacg.medimorphosis.com.au/.venv/lib/python3.11/site-packages/trac/loader.py", line 80, in _load_eggs
entry.load(require=True)
File "/var/webapps/dev.tracker.wacg.medimorphosis.com.au/.venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2777, in load
return self.resolve()
^^^^^^^^^^^^^^
File "/var/webapps/dev.tracker.wacg.medimorphosis.com.au/.venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2783, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/webapps/dev.tracker.wacg.medimorphosis.com.au/.venv/lib/python3.11/site-packages/trachours/db.py", line 17, in <module>
from tracsqlhelper import *
File "/var/webapps/dev.tracker.wacg.medimorphosis.com.au/.venv/lib/python3.11/site-packages/tracsqlhelper/__init__.py", line 29
except Exception, e:
^^^^^^^^^^^^
Attachments (0)
Change History (7)
comment:1 Changed 4 months ago by
comment:2 Changed 4 months ago by
Proposed patch - fixes the issue in my test Trac 1.6:
diff --git a/setup.py b/setup.py
index b24a480..66f4c20 100755
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@
from setuptools import setup, find_packages
-version = '0.3.1'
+version = '0.4.0'
setup(name='TracSQLHelper',
version=version,
diff --git a/tracsqlhelper/__init__.py b/tracsqlhelper/__init__.py
index 80a7bec..d629712 100755
--- a/tracsqlhelper/__init__.py
+++ b/tracsqlhelper/__init__.py
@@ -26,7 +26,7 @@ class SQLHelper(object):
cursor = db.cursor()
cursor.execute(sql, params)
_data = self.actions(cursor)
- except Exception, e:
+ except Exception as e:
env.log.error("""There was a problem executing sql:%s
with parameters:%s
Exception:%s""" %(sql, params, e))
comment:4 Changed 4 months ago by
Ah, sorry for forgetting to include the patch author in the commit message....
comment:5 Changed 4 months ago by
I'm going to fix the following.
unicodekeyword- Using dict.keys() and dict.items()
- update_row_from_dict has SQL injection
comment:6 Changed 4 months ago by
| Owner: | set to Jun Omae |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
In 18700:
comment:7 Changed 4 months ago by
| Owner: | changed from Jun Omae to Rob Hills |
|---|
Note: See
TracTickets for help on using
tickets.



Please contribute patch to make compatible with Python 3 and Trac 1.6. I think the plugin is no longer needed....