Opened 16 years ago

Closed 16 years ago

Last modified 5 years ago

#1637 defect closed fixed (fixed)

many examples use deprecated imports

Reported by: Stephen Thorne Owned by: Stephen Thorne
Priority: highest Milestone:
Component: mail Keywords:
Cc: Branch:
Author:

Description

twisted.protocols.smtp and twisted.protocols.imap4 is now twisted.mail.smtp and twisted.mail.imap4.

See attached patch.

Attachments (1)

maildocpatch.diff (826 bytes) - added by Stephen Thorne 16 years ago.

Download all attachments as: .zip

Change History (12)

Changed 16 years ago by Stephen Thorne

Attachment: maildocpatch.diff added

comment:1 Changed 16 years ago by Stephen Thorne

Component: coremail
Owner: changed from Glyph to Stephen Thorne
Priority: normallow
Status: newassigned
Summary: twisted.mail examples use deprecated imports[PATCH] twisted.mail examples use deprecated imports
Type: enhancementdefect

comment:2 Changed 16 years ago by Jean-Paul Calderone

Keywords: review added
Owner: changed from Stephen Thorne to Jean-Paul Calderone
Status: assignednew

comment:3 Changed 16 years ago by Jean-Paul Calderone

Priority: lowhighest

comment:4 Changed 16 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: changed from Jean-Paul Calderone to Stephen Thorne

Patch looks good, so far as it goes. Perhaps there are other occurrences of this in the repository? It'd be nice to fix them all. Can you check and update the patch if you find any?

comment:5 Changed 16 years ago by Stephen Thorne

There's one or two. I'm going to patch what I can see...

$ find . -name \*.py | xargs grep twisted.protocols  | wc -l
      53

comment:6 Changed 16 years ago by Stephen Thorne

How to hunt down these bugs:

import os
for line in os.popen('find . -name \*.py | xargs grep twisted.protocols', 'r'):
    fname, code = line.strip().split(':', 1)
    code = code.strip()
    try:
        exec code
    except DeprecationWarning:
        print fname, '->', code
    except:
        pass

comment:7 Changed 16 years ago by Stephen Thorne

Keywords: review added

branch is maildoc-1637 - there's a heap of changes, and the script snippet above (which must be run with python -Werror) will come up clean except for twisted.protocols.telnet, which ./twisted/manhole/telnet.py and ./twisted/test/test_import.py both still use.

comment:8 Changed 16 years ago by Stephen Thorne

Owner: changed from Stephen Thorne to Jean-Paul Calderone
Summary: [PATCH] twisted.mail examples use deprecated importsmany examples use deprecated imports

comment:9 Changed 16 years ago by jknight

Owner: changed from Jean-Paul Calderone to Stephen Thorne

Looks good, ship it.

comment:10 Changed 16 years ago by stephen

Resolution: fixed
Status: newclosed

(In [17455]) Remove deprecated 'from twisted.protocols import foo' imports from our examples.

Authors: jerub Reviewer: exarkun Closes #1637

A quick little script was used to find imports from 'twisted.protocols', then go through and import those files and see if a DeprecationWarning comes up.

import os for line in os.popen('find . -name \*.py | xargs grep twisted.protocols', 'r'):

fname, code = line.strip().split(':', 1) code = code.strip() try:

exec code

except DeprecationWarning:

print fname, '->', code

except:

pass

By this method, a large number of deprecated imports were discovered and corrected.

comment:11 Changed 5 years ago by hawkowl

Keywords: review removed

[mass edit] Removing review from closed tickets.

Note: See TracTickets for help on using tickets.