Ticket #9990 (closed defect: fixed)

Opened 1 year ago

Last modified 10 months ago

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

Reported by: glenn@byte-consult.be Assigned to: 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

Change History

(follow-up: ↓ 3 ) 04/25/12 19:56:57 changed by glenn@byte-consult.be

  • status changed from new to closed.
  • resolution set to fixed.

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

05/09/12 09:37:34 changed by rjollos

  • description changed.

(in reply to: ↑ 1 ) 05/10/12 00:31:49 changed by rjollos

  • status changed from closed to reopened.
  • resolution deleted.

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.

05/10/12 00:32:40 changed by rjollos

  • status changed from reopened to new.
  • owner changed from coling to rjollos.

(follow-up: ↓ 6 ) 05/10/12 00:41:44 changed by 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...

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.

(in reply to: ↑ 5 ) 05/10/12 00:46:41 changed 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!

07/30/12 04:20:47 changed by rjollos

  • status changed from new to assigned.
  • component changed from WorkLogPlugin to ClientsPlugin.

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!

07/30/12 04:24:32 changed by rjollos

  • status changed from assigned to closed.
  • resolution set to fixed.

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


Add/Change #9990 (DeprecationWarning : the md5 module is deprecated - Causes tab-completion to fail in trac-admin)




Change Properties
Action