Modify

Opened 9 years ago

Closed 7 years ago

Last modified 7 years ago

#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 Jun Omae)

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 9 years ago by Jun Omae

Description: modified (diff)

comment:2 Changed 9 years ago by Ryan J Ollos

#11127 closed as a duplicate.

comment:4 Changed 9 years ago by Ryan J Ollos

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 7 years ago by Ryan J Ollos

Summary: Database connection is brokenAttributeError: 'Environment' object has no attribute 'get_db_cnx'

comment:6 Changed 7 years ago by Ryan J Ollos

#12932 closed as a duplicate.

comment:7 Changed 7 years ago by Jacob

Are there any plans to make this plugin compatible with 1.2?

comment:8 Changed 7 years ago by Ryan J Ollos

Status: newaccepted

comment:9 Changed 7 years ago by Ryan J Ollos

In 16031:

4.0.0dev: Require Trac >= 1.0

Refs #12193.

comment:10 Changed 7 years ago by Jacob

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 7 years ago by Ryan J Ollos

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:12 Changed 7 years ago by Jacob

Sounds good :)

comment:13 Changed 7 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 16038:

4.0.0dev: Use Trac 1.0 database API

Fixes #11932, #12193.

comment:14 Changed 7 years ago by Jacob

The latest update works for me in 1.2, and I'll keep testing over the next few days as you suggested.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
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.