Modify

Opened 5 years ago

Closed 5 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: Ryan J Ollos
Priority: normal Component: ClientsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by Ryan J Ollos)

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 Changed 5 years ago by glenn@…

Resolution: fixed
Status: newclosed

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 5 years ago by Ryan J Ollos

Description: modified (diff)

comment:3 in reply to:  1 Changed 5 years ago by Ryan J Ollos

Resolution: fixed
Status: closedreopened

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 5 years ago by Ryan J Ollos

Owner: changed from Colin Guthrie to Ryan J Ollos
Status: reopenednew

comment:5 Changed 5 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 5 years ago by Ryan J Ollos

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 5 years ago by Ryan J Ollos

Component: WorkLogPluginClientsPlugin
Status: newassigned

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 5 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

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

Modify Ticket

Action
as closed The owner will remain Ryan J Ollos.
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.