#12193 closed defect (fixed)
AttributeError: 'Environment' object has no attribute 'get_db_cnx'
Reported by: | Timothy Reaves | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | MasterTicketsPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.2 |
Description (last modified by )
With both version 3.0.1 & 3.0.5dev, the following error occurs with Trac 1.1.4dev (works with 1.1.2dev).
AttributeError: 'Environment' object has no attribute 'get_db_cnx' File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.4dev_r0-py2.7.egg/trac/web/main.py", line 551, in _dispatch_request File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.4dev_r0-py2.7.egg/trac/web/main.py", line 235, in dispatch File "/usr/local/lib/python2.7/dist-packages/Trac-1.1.4dev_r0-py2.7.egg/trac/web/main.py", line 385, in _post_process_request File "/usr/local/lib/python2.7/dist-packages/TracMasterTickets-3.0.5dev_r0-py2.7.egg/mastertickets/web_ui.py", line 77, in post_process_request File "/usr/local/lib/python2.7/dist-packages/TracMasterTickets-3.0.5dev_r0-py2.7.egg/mastertickets/model.py", line 27, in __init__
Attachments (0)
Change History (14)
comment:1 Changed 10 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 10 years ago by
comment:3 Changed 9 years ago by
May be this change can be backported: https://github.com/SpamExperts/trac-masterticketsplugin/commit/3f64452a93d516aa72d97f94eaa960ac9ef56a57
comment:4 Changed 9 years ago by
If you decide to use that as the basis for creating a patch, please consider refactoring like in the following example:
- with self.env.db_query as db: - cursor = db.cursor() - cursor.execute("SELECT value FROM system WHERE name=%s", (db_default.name,)) - value = cursor.fetchone() + for version, in self.env.db_query(""" + SELECT value FROM system WHERE name=%s + """, (db_default.name,)):
comment:5 Changed 8 years ago by
Summary: | Database connection is broken → AttributeError: 'Environment' object has no attribute 'get_db_cnx' |
---|
comment:8 Changed 8 years ago by
Status: | new → accepted |
---|
comment:10 Changed 8 years ago by
Great to see you're working on this 👍👍👍
I tried the latest version. Works fine in 1.0.13 but I get the same error in 1.2. Here's the Python Traceback:
Most recent call last: File "/usr/local/lib/python2.7/dist-packages/Trac-1.2-py2.7.egg/trac/web/main.py", line 613, in _dispatch_request File "/usr/local/lib/python2.7/dist-packages/Trac-1.2-py2.7.egg/trac/web/main.py", line 263, in dispatch File "/usr/local/lib/python2.7/dist-packages/Trac-1.2-py2.7.egg/trac/web/main.py", line 444, in _post_process_request File "/usr/local/lib/python2.7/dist-packages/TracMasterTickets-4.0.0dev_r16031-py2.7.egg/mastertickets/web_ui.py", line 79, in post_process_request File "/usr/local/lib/python2.7/dist-packages/TracMasterTickets-4.0.0dev_r16031-py2.7.egg/mastertickets/model.py", line 27, in __init__
comment:11 Changed 8 years ago by
The changes I'll commit soon could benefit from additional testing. I suggest deploying to a staging environment and testing before installing to production.
comment:14 Changed 8 years ago by
The latest update works for me in 1.2, and I'll keep testing over the next few days as you suggested.
#11127 closed as a duplicate.