Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12931 closed defect (fixed)

AttributeError when using TicketImportPlugin in Trac 1.2

Reported by: Jacob Owned by: Jun Omae
Priority: normal Component: TicketImportPlugin
Severity: normal Keywords:
Cc: Jun Omae Trac Release: 1.2

Description

When I try importing a file in Trac 1.2, I get:

Trac detected an internal error:

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

Attachments (1)

12931-AttributeError-stacktrace.txt (78.0 KB) - added by Jacob 6 years ago.
stacktrace of AttributeError on Execute Import with patch t12931

Download all attachments as: .zip

Change History (18)

comment:1 Changed 6 years ago by François Granade

hi, we haven't updated this plugin to work with the latest versions of Trac; in fact it hasn't been maintained for a few years... If there is still some interest to it, I could work at upgrading it, I don't think it should be too difficult. Please tell me how important it is to you. In particular: are there other, more recent, better maintained, plugins that would do the job ? if yes, please use them; if not, tell me and I'll try to work on it. Thank !

comment:2 Changed 6 years ago by Jun Omae

Owner: changed from François Granade to Jun Omae
Status: newaccepted

Hi farialima,

I worked to make compatible with Trac 1.1.2+ two years ago. I resume it. Thanks.

comment:3 Changed 6 years ago by Jacob

The plugin is important enough for me that I've decided to not upgrade to 1.2 until I can get it and a few other business-critical plugins working.

I should have mentioned that it was version 0.8.3 of TicketImport 0.8.3 that was causing the error, I couldn't find a more recent version.

Batch Modify does some of what I need, but not everything. I actually don't understand why Trac would have a built-in export function (i.e. ability to download results as CSV) without also having a built-in import function...

The only other plugin I could find that does something similar is ExportImportXlsPlugin. I tried it but that didn't work either (although it broke differently), and I prefer TicketImportPlugin's simplicity.

Thanks to both you! Looking forward to the update, and I can help test it for you.

Last edited 6 years ago by Jacob (previous) (diff)

comment:5 Changed 6 years ago by Jacob

How do I install it? I'm used to using easy_install or Python eggs

Last edited 6 years ago by Jacob (previous) (diff)

comment:6 Changed 6 years ago by Jun Omae

comment:7 Changed 6 years ago by Jacob

I tried installing the patch:

easy_install ticketimportplugin-t12931/

Processing
Writing /tmp/ticketimportplugin-t12931/setup.cfg
Running setup.py -q bdist_egg --dist-dir /tmp/ticketimportplugin-t12931/egg-dist-tmp-04tNho
TicketImport 0.8.3 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.7/dist-packages/TicketImport-0.8.3-py2.7.egg
Processing dependencies for TicketImport==0.8.3
Finished processing dependencies for TicketImport==0.8.3

And when I try an import, Internal Error is still happening.

comment:8 in reply to:  7 ; Changed 6 years ago by Jun Omae

And when I try an import, Internal Error is still happening.

Please post the errors with stacktrace after enabling TracLogging.

Last edited 6 years ago by Jun Omae (previous) (diff)

comment:9 in reply to:  8 Changed 6 years ago by Jun Omae

Replying to jun66j5:

And when I try an import, Internal Error is still happening.

Please post the errors with stacktrace after enabling TracLogging.

Works for me. Confirmed with Trac 1.2 and the t12931.zip.

comment:10 Changed 6 years ago by Jacob

Did I install the patch properly?

Is it normal that it says 0.8.3 is already the active version?

Could this be a conflict with a different plugin?

comment:11 Changed 6 years ago by Jun Omae

Please post the errors with stacktrace after enabling TracLogging.

Also,

  1. You should uninstall un-patched TicketImportPlugin first.
  2. Confirm missing Import tab in navigation menu after the plugin is uninstalled
  3. Install t12931.zip

comment:12 Changed 6 years ago by Jacob

Ok. Followed your steps outlined above.

There is progress. I am now able to preview the import file, and cancel the import without errors, but if I instead choose to go ahead and Execute Import, I get the same AttributeError.

I've attached the stacktrace, the error is at the end.

Changed 6 years ago by Jacob

stacktrace of AttributeError on Execute Import with patch t12931

comment:13 Changed 6 years ago by Jun Omae

That's a MasterTicketsPlugin issue. Retry after uninstalling MasterTicketsPlugin.

  File "/usr/local/lib/python2.7/dist-packages/Trac-1.2-py2.7.egg/trac/ticket/model.py", line 397, in save_changes
    listener.ticket_changed(self, comment, author, old_values)
  File "/usr/local/lib/python2.7/dist-packages/TracMasterTickets-3.0.5dev_r12950-py2.7.egg/mastertickets/api.py", line 117, in ticket_changed
    db = self.env.get_db_cnx()
AttributeError: 'Environment' object has no attribute 'get_db_cnx'
Last edited 6 years ago by Jun Omae (previous) (diff)

comment:14 in reply to:  13 Changed 6 years ago by Jun Omae

  File "/usr/local/lib/python2.7/dist-packages/Trac-1.2-py2.7.egg/trac/ticket/model.py", line 397, in save_changes
    listener.ticket_changed(self, comment, author, old_values)
  File "/usr/local/lib/python2.7/dist-packages/TracMasterTickets-3.0.5dev_r12950-py2.7.egg/mastertickets/api.py", line 117, in ticket_changed
    db = self.env.get_db_cnx()
AttributeError: 'Environment' object has no attribute 'get_db_cnx'

See #12193.

comment:15 Changed 6 years ago by Jacob

You're right. If I disable MasterTicketsPlugin, I can now import successfully. Yes!

comment:16 Changed 6 years ago by Jun Omae

Resolution: fixed
Status: acceptedclosed

In 15948:

ticketimportplugin: add support of Trac 1.1.2+ (closes #12931)

comment:17 Changed 6 years ago by Jun Omae

In 15949:

ticketimportplugin: add missing file (refs #12931)

Modify Ticket

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