#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 )
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)
Change History (12)
comment:1 Changed 9 years ago by
| Trac Release: | → 1.2 |
|---|
comment:2 Changed 9 years ago by
| Description: | modified (diff) |
|---|
comment:3 follow-up: 4 Changed 9 years ago by
| Owner: | set to Ryan J Ollos |
|---|---|
| Status: | new → accepted |
comment:4 Changed 9 years ago by
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.
comment:5 Changed 9 years ago by
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:7 follow-up: 8 Changed 9 years ago by
Nice work. I'll do a small bit of refactoring and commit the patch.
comment:8 follow-up: 11 Changed 9 years ago by
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:10 Changed 9 years ago by
| Owner: | changed from Ryan J Ollos to EmeCas |
|---|
comment:11 Changed 9 years ago by
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.



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.