Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#12975 closed defect (fixed)

AttributeError: 'Environment' object has no attribute 'get_db_cnx'

Reported by: EmeCas Owned by: EmeCas
Priority: normal Component: TracHoursPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.2

Description (last modified by Ryan J Ollos)

Getting error message after activate TracHoursPlugin when I click on Roadmap option

Python Traceback
Most recent call last:

    File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 613, in _dispatch_request
    File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 273, in dispatch
    File "/usr/lib64/python2.7/site-packages/trac/web/chrome.py", line 1123, in render_template
    File "/usr/lib64/python2.7/site-packages/genshi/core.py", line 133, in __or__
    File "/usr/lib64/python2.7/site-packages/trac/web/chrome.py", line 1436, in inner
    File "/usr/lib/python2.7/site-packages/TracHoursPlugin-0.6.0.dev0-py2.7.egg/trachours/web_ui.py", line 79, in filter_stream

Issue disappears when plugin is deactivated.

Similar to #12934.

Attachments (1)

trachours1_2.patch (3.0 KB) - added by EmeCas 7 years ago.
Ticket 12975_20161129.patch

Download all attachments as: .zip

Change History (12)

comment:1 Changed 7 years ago by EmeCas

Trac Release: 1.2

comment:2 Changed 7 years ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 7 years ago by Ryan J Ollos

Owner: set to Ryan J Ollos
Status: newaccepted

You'll encounter this issue frequently for plugins that lack the 1.2 tag. I will get to fixing this one eventually, but I have quite a backlog at the moment.

comment:4 in reply to:  3 Changed 7 years ago by EmeCas

Replying to rjollos:

You'll encounter this issue frequently for plugins that lack the 1.2 tag. I will get to fixing this one eventually, but I have quite a backlog at the moment.

Thanks, maybe with some guidelines from you on the important points about migration from version 1.0 to 1.2 that cause the issue as well as any tip about the required development environment that you consider relevant , so I can get into the context, then I could take care of producing the patch, as well as I have seen in the current data model support for optional/additional features.

Just let me know if you are agree.

Changed 7 years ago by EmeCas

Attachment: trachours1_2.patch added

Ticket 12975_20161129.patch

comment:5 Changed 7 years ago by EmeCas

The attached file: trachours1_2.patch solves the issue by using with self.env.db_transaction as db: instead of db = self.env.get_db_cnx()

comment:6 Changed 7 years ago by Ryan J Ollos

In 16029:

0.6.0dev: Require Trac >= 1.0

Refs #12975.

comment:7 Changed 7 years ago by Ryan J Ollos

Nice work. I'll do a small bit of refactoring and commit the patch.

comment:8 in reply to:  7 ; Changed 7 years ago by EmeCas

Replying to rjollos:

Nice work. I'll do a small bit of refactoring and commit the patch.

Thanks, just an additional question, what would be the important points to keep backward compatibility?

comment:9 Changed 7 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 16030:

0.6.0dev: Adapt to Trac 1.0 database API

Fixes #12975.

comment:10 Changed 7 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to EmeCas

comment:11 in reply to:  8 Changed 7 years ago by Ryan J Ollos

Replying to emecas:

Replying to rjollos:

Nice work. I'll do a small bit of refactoring and commit the patch.

Thanks, just an additional question, what would be the important points to keep backward compatibility?

You could do something like this to keep compatibility back to 0.11: ticketimportplugin/0.11/talm_importer/compat.py.

However, I don't bother with supporting users that are on Trac < 1.0, and your patch as well as r16030 support Trac >= 1.0.

I'd recommend focusing on the Trac 1.0 database API: trac:TracDev/DatabaseApi#Trac1.0API.

Modify Ticket

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