Changes between and of Version 2Version 7Ticket #5789


Ignore:
Timestamp:
01/22/2013 02:37:47 PM (20 months ago)
Author:
thijs
Comment:
  • during the python 3 port (r36719) OrderedDict in python.util changed it's base class from UserDict to object for python 3 only.
  • usage of DictMixin in http_headers was removed during the python 3 port.
  • the following classes still use UserDict (excluding python.util):
    twisted/protocols/postfix.py:import UserDict
    twisted/protocols/postfix.py: UserDict.UserDict):
    twisted/manhole/explorer.py:import UserDict
    twisted/manhole/explorer.py:class Pool(UserDict.UserDict):
    

I suggest we remove usage of UserDict once Python 2.6 support is dropped or python 3 support is added for manhole.explorer or protocols.postfix. Updating the ticket description and priority.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5789

    • Property Keywords py3k added
    • Property Owner set to vperic
    • Property Priority changed from normal to lowest
    • Property Summary changed from Replace usage of UserDict with twisted.python.compat version to Remove usage of UserDict
  • Ticket #5789 – Description

    v2 v7  
    1 `UserDict` was moved to the [http://docs.python.org/py3k/library/collections.html#collections.UserDict collections] module in Python 3.x. We can add a twisted.python.compat version, like we did with `execfile` or it will throw errors in python 3. 
     1Remove usage of `UserDict` once Python 2.6 support is dropped completely (or `manhole.explorer` or `protocols.postfix` are ported to python 3). 
    22 
    33{{{ 
    4 ./twisted/web/http_headers.py:96:    # <http://docs.python.org/lib/module-UserDict.html>. 
    5 ./twisted/protocols/postfix.py:10:import UserDict 
    6 ./twisted/protocols/postfix.py:96:                                     UserDict.UserDict): 
    7 ./twisted/python/util.py:15:from UserDict import UserDict 
    8 ./twisted/python/util.py:143:class OrderedDict(UserDict): 
    9 ./twisted/python/util.py:144:    """A UserDict that preserves insert order whenever possible.""" 
    10 ./twisted/python/util.py:162:        UserDict.__setitem__(self, key, value) 
    11 ./twisted/python/util.py:168:        UserDict.__delitem__(self, key) 
    12 ./twisted/manhole/explorer.py:19:import UserDict 
    13 ./twisted/manhole/explorer.py:29:class Pool(UserDict.UserDict): 
     4twisted/protocols/postfix.py:import UserDict 
     5twisted/protocols/postfix.py: UserDict.UserDict): 
     6twisted/manhole/explorer.py:import UserDict 
     7twisted/manhole/explorer.py:class Pool(UserDict.UserDict): 
    148}}} 
    15  
    16 And it looks like `DictMixin` is gone but you should be able to use `MutableMapping` with some adjustment. 
    17  
    18 {{{ 
    19 ./twisted/web/http_headers.py:10:from UserDict import DictMixin 
    20 }}}