Modify

Opened 2 years ago

Closed 2 years ago

#9990 closed defect (fixed)

DeprecationWarning : the md5 module is deprecated - Causes tab-completion to fail in trac-admin

Reported by: glenn@… Owned by: rjollos
Priority: normal Component: ClientsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by rjollos)

Pressing tab in trac-admin causes this warning generated by clientsplugin:

Trac [/var/projects/frontend]> /usr/local/lib/python2.6/dist-packages/clients-0.4-py2.6.egg/clients/events.py:1: DeprecationWarning: the md5 module is deprecated; use hashlib instead

Completion error: AttributeError: 'WorklogAdminPanel' object has no attribute 'get_admin_commands'

I guess it's time to go to hashlib instead :) There info about some patch supposedly done on trac core on a prolem like this a few years back. The first time I've seen it pop up though (other trac/worklog combo's seem to be silent about it).

See t:#7458

Thanks for whatever effort you put in this, I've seen it's been a long time that any updates on this plugins came in, I sure like it. I've been looking for that start/stop logic forever.

Attachments (0)

Change History (8)

comment:1 follow-up: Changed 2 years ago by glenn@…

  • Resolution set to fixed
  • Status changed from new to closed

Actually, I messed up the module, the fix for WorkLogPlugin problem is this:

events.py

try:
    import hashlib
    md = hashlib.md5()
except ImportError:
    # for Python << 2.5
    import md5
    md = md5.new()

and for clients plugin which is my mistake here , in webadminui.py add to class WorklogAdminPanel.

    def get_admin_commands(self):
        return None

comment:2 Changed 2 years ago by rjollos

  • Description modified (diff)

comment:3 in reply to: ↑ 1 Changed 2 years ago by rjollos

  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to glenn@byte-consult.be:

Actually, I messed up the module, the fix for WorkLogPlugin problem is this:

Usually tickets are left open until a fix is applied to the trunk. No harm though.

I'd previously implemented a similar fix for the GraphvizPlugin in comment:15:ticket:5747.

comment:4 Changed 2 years ago by rjollos

  • Owner changed from coling to rjollos
  • Status changed from reopened to new

comment:5 follow-up: Changed 2 years ago by glenn@…

Oh, I'm sorry. I didn't realize this is actually picked up in that manner. I see many plugins missing the get_admin_commands part...

the reason I closed directly (should perhaps have used invalid) is because the trac-admin error wasn't the reason that pressing tab on the console threw an error, it just showed up along with the plugin. The plugin was the real reason it blew up. But the md5 issue is indeed still there. Tx for caring.

comment:6 in reply to: ↑ 5 Changed 2 years ago by rjollos

Replying to glenn@byte-consult.be:

Oh, I'm sorry. I didn't realize this is actually picked up in that manner. I see many plugins missing the get_admin_commands part...

If this is an issue for other plugins, I'd be happy to apply a fix to those as well. Most plugins aren't maintained, but if you open a ticket and cc me on it, I'll get it applied to the trunk.

Thanks for reporting and providing a fix!

comment:7 Changed 2 years ago by rjollos

  • Component changed from WorkLogPlugin to ClientsPlugin
  • Status changed from new to assigned

The issue you point out with events.py is in the ClientsPlugin, and that will be fixed in a moment. WorkLogPlugin doesn't import md5 and doesn't implement IAdminCommandProvider, so I don't see any problems with it.

Please reopen if I'm missing something that you can clarify. Thanks!

comment:8 Changed 2 years ago by rjollos

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [11834]) Fixes #9990: Avoid deprecation warning for md5 package by importing md5 from trac.util.compat, when available (Trac 0.11.3+).

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from rjollos. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.