Ticket #5385: 5385-patch.patch

File 5385-patch.patch, 7.1 KB (added by moijes12, 3 years ago)

Modified 1. twisted.internet.error.py : Removed comment 'works only in 2.2' from function getConnectionError 2. twisted.python.filepath.py : Removed comment 'new in 2.2.0' 3. twisted.test.test_compat.py : Modified method testIsinstance of class CompatTestCase.Removed # I'm pretty sure it's impossible to implement this # without replacing isinstance on 2.2 as well :( # self.assert_(isinstance({}, dict)) 4. doc.web.examples : Removed comment # This module is standard in Python 2.2, otherwise get it from # http://www.pythonware.com/products/xmlrpc/ 5. twisted.python.reflect.py : Removed comment 'This provides compatability with the pre-2.2 Accessor mixin, up to a point.' Removed Comment ', or using non-2.1 compatible code' Removed Comment 'This implementation is for Python 2.1.' 6. twisted.python.dist.py : removed comment 'This is necessary for Python 2.2's distutils.' from docstring for function getPackages 7. doc/core/development/policy/coding-standard.xhtml : Removed section on new style classes. 8. doc/core/howto/pb-copyable.xhtml : Removed 'The semi-magical <q>property attributes</q> that were introduced in Python 2.2 could be useful too. The result might be hard to maintain or extend, though.' 9. doc/web/howto/xmlrpc.xhtml : Removed 'that is included with Python 2.2 and later.'

  • twisted/test/test_compat.py

     
    8181 
    8282    def testIsinstance(self): 
    8383        self.assert_(isinstance(u'hi', types.StringTypes)) 
    84         self.assert_(isinstance(self, unittest.TestCase)) 
    85         # I'm pretty sure it's impossible to implement this 
    86         # without replacing isinstance on 2.2 as well :( 
    87         # self.assert_(isinstance({}, dict)) 
     84        self.assert_(isinstance(self, unittest.TestCase))        
    8885 
    8986    def testStrip(self): 
    9087        self.assertEqual(' x '.lstrip(' '), 'x ') 
  • twisted/python/filepath.py

     
    11101110            os.unlink(self.path) 
    11111111        os.rename(sib.path, self.path) 
    11121112 
    1113  
    1114     # new in 2.2.0 
    1115  
    11161113    def __cmp__(self, other): 
    11171114        if not isinstance(other, FilePath): 
    11181115            return NotImplemented 
  • twisted/python/reflect.py

     
    5656class AccessorType(type): 
    5757    """Metaclass that generates properties automatically. 
    5858 
    59     This is for Python 2.2 and up. 
    60  
    6159    Using this metaclass for your class will give you explicit accessor 
    6260    methods; a method called set_foo, will automatically create a property 
    6361    'foo' that uses set_foo as a setter method. Same for get_foo and del_foo. 
     
    6866    be used if they are present upon class creation, and no getter function 
    6967    was set - if a getter is present, the class attribute will be ignored. 
    7068 
    71     This is a 2.2-only alternative to the Accessor mixin - just set in your 
    72     class definition:: 
    73  
    7469        __metaclass__ = AccessorType 
    75  
    7670    """ 
    7771 
    7872    def __init__(self, name, bases, d): 
     
    111105 
    112106 
    113107class PropertyAccessor(object): 
    114     """A mixin class for Python 2.2 that uses AccessorType. 
     108    """A mixin class for that uses AccessorType.     
    115109 
    116     This provides compatability with the pre-2.2 Accessor mixin, up 
    117     to a point. 
    118  
    119110    Extending this class will give you explicit accessor methods; a 
    120111    method called set_foo, for example, is the same as an if statement 
    121112    in __setattr__ looking for 'foo'.  Same for get_foo and del_foo. 
    122113 
    123114    There are also reallyDel and reallySet methods, so you can 
    124115    override specifics in subclasses without clobbering __setattr__ 
    125     and __getattr__, or using non-2.1 compatible code. 
     116    and __getattr__. 
    126117 
    127118    There is are incompatibilities with Accessor - accessor 
    128119    methods added after class creation will *not* be detected. OTOH, 
     
    154145    in L{__setattr__} looking for C{'foo'}.  Same for C{get_foo} and 
    155146    C{del_foo}.  There are also L{reallyDel} and L{reallySet} methods, 
    156147    so you can override specifics in subclasses without clobbering 
    157     L{__setattr__} and L{__getattr__}. 
    158  
    159     This implementation is for Python 2.1. 
     148    L{__setattr__} and L{__getattr__}.     
    160149    """ 
    161150 
    162151    def __setattr__(self, k,v): 
  • twisted/python/dist.py

     
    210210 
    211211def getPackages(dname, pkgname=None, results=None, ignore=None, parent=None): 
    212212    """ 
    213     Get all packages which are under dname. This is necessary for 
    214     Python 2.2's distutils. Pretty similar arguments to getDataFiles, 
     213    Get all packages which are under dname.  Pretty similar arguments to getDataFiles, 
    215214    including 'parent'. 
    216215    """ 
    217216    parent = parent or "" 
  • twisted/internet/error.py

     
    194194        return ConnectError(string=e) 
    195195 
    196196    if hasattr(socket, 'gaierror') and isinstance(e, socket.gaierror): 
    197         # only works in 2.2 
    198197        klass = UnknownHostError 
    199198    else: 
    200199        klass = errnoMapping.get(number, ConnectError) 
  • doc/core/howto/pb-copyable.xhtml

     
    405405attribute is changed<span class="footnote">Of course you could be clever and 
    406406add a hook to <code>__setattr__</code>, along with magical change-announcing 
    407407subclasses of the usual builtin types, to detect changes that result from 
    408 normal <q>=</q> set operations. The semi-magical <q>property attributes</q> 
    409 that were introduced in Python 2.2 could be useful too. The result might be 
    410 hard to maintain or extend, though.</span>.</p> 
     408normal <q>=</q> set operations.</span>.</p> 
    411409 
    412410<p>You derive your sender-side class from <code>pb.Cacheable</code>, and you 
    413411add two methods: <code class="API" 
  • doc/core/development/policy/coding-standard.xhtml

     
    460460    imported directly into the user's namespace and not cause 
    461461    confusion.</p> 
    462462 
    463     <h3>New-style Classes</h3> 
    464  
    465     <p>Classes and instances in Python come in two flavors: old-style or 
    466     classic, and new-style. Up to Python 2.1, old-style classes were the 
    467     only flavour available to the user, new-style classes were introduced 
    468     in Python 2.2 to unify classes and types. All classes added to Twisted 
    469     should be written as new-style classes. If <code class="python">x</code> 
    470     is an instance of a new-style class, then <code class="python">type(x)</code> 
    471     is the same as <code class="python">x.__class__</code>.</p> 
    472  
    473463    <h2>Methods</h2> 
    474464 
    475465    <p>Methods should be in mixed case, with the first letter lower 
  • doc/web/howto/xmlrpc.xhtml

     
    1515<p><a href="http://www.xmlrpc.com">XML-RPC</a> is a simple request/reply protocol 
    1616that runs over HTTP. It is simple, easy to implement and supported by most programming 
    1717languages. Twisted's XML-RPC support is implemented using the 
    18 <a href='http://docs.python.org/library/xmlrpclib.html'>xmlrpclib</a> library that is 
    19 included with Python 2.2 and later.</p> 
     18<a href='http://docs.python.org/library/xmlrpclib.html'>xmlrpclib</a> library.</p> 
    2019 
    2120<h2>Creating a XML-RPC server</h2> 
    2221 
  • doc/web/examples/xmlrpc.py

     
    2121 
    2222from twisted.web import xmlrpc 
    2323from twisted.internet import defer 
    24  
    25 # This module is standard in Python 2.2, otherwise get it from 
    26 #   http://www.pythonware.com/products/xmlrpc/ 
    2724import xmlrpclib 
    2825 
    2926