Ticket #5385: 5385-patch.patch
| File 5385-patch.patch, 7.1 KB (added by moijes12, 17 months ago) |
|---|
-
twisted/test/test_compat.py
81 81 82 82 def testIsinstance(self): 83 83 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)) 88 85 89 86 def testStrip(self): 90 87 self.assertEqual(' x '.lstrip(' '), 'x ') -
twisted/python/filepath.py
1110 1110 os.unlink(self.path) 1111 1111 os.rename(sib.path, self.path) 1112 1112 1113 1114 # new in 2.2.01115 1116 1113 def __cmp__(self, other): 1117 1114 if not isinstance(other, FilePath): 1118 1115 return NotImplemented -
twisted/python/reflect.py
56 56 class AccessorType(type): 57 57 """Metaclass that generates properties automatically. 58 58 59 This is for Python 2.2 and up.60 61 59 Using this metaclass for your class will give you explicit accessor 62 60 methods; a method called set_foo, will automatically create a property 63 61 'foo' that uses set_foo as a setter method. Same for get_foo and del_foo. … … 68 66 be used if they are present upon class creation, and no getter function 69 67 was set - if a getter is present, the class attribute will be ignored. 70 68 71 This is a 2.2-only alternative to the Accessor mixin - just set in your72 class definition::73 74 69 __metaclass__ = AccessorType 75 76 70 """ 77 71 78 72 def __init__(self, name, bases, d): … … 111 105 112 106 113 107 class PropertyAccessor(object): 114 """A mixin class for Python 2.2 that uses AccessorType.108 """A mixin class for that uses AccessorType. 115 109 116 This provides compatability with the pre-2.2 Accessor mixin, up117 to a point.118 119 110 Extending this class will give you explicit accessor methods; a 120 111 method called set_foo, for example, is the same as an if statement 121 112 in __setattr__ looking for 'foo'. Same for get_foo and del_foo. 122 113 123 114 There are also reallyDel and reallySet methods, so you can 124 115 override specifics in subclasses without clobbering __setattr__ 125 and __getattr__ , or using non-2.1 compatible code.116 and __getattr__. 126 117 127 118 There is are incompatibilities with Accessor - accessor 128 119 methods added after class creation will *not* be detected. OTOH, … … 154 145 in L{__setattr__} looking for C{'foo'}. Same for C{get_foo} and 155 146 C{del_foo}. There are also L{reallyDel} and L{reallySet} methods, 156 147 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__}. 160 149 """ 161 150 162 151 def __setattr__(self, k,v): -
twisted/python/dist.py
210 210 211 211 def getPackages(dname, pkgname=None, results=None, ignore=None, parent=None): 212 212 """ 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, 215 214 including 'parent'. 216 215 """ 217 216 parent = parent or "" -
twisted/internet/error.py
194 194 return ConnectError(string=e) 195 195 196 196 if hasattr(socket, 'gaierror') and isinstance(e, socket.gaierror): 197 # only works in 2.2198 197 klass = UnknownHostError 199 198 else: 200 199 klass = errnoMapping.get(number, ConnectError) -
doc/core/howto/pb-copyable.xhtml
405 405 attribute is changed<span class="footnote">Of course you could be clever and 406 406 add a hook to <code>__setattr__</code>, along with magical change-announcing 407 407 subclasses 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> 408 normal <q>=</q> set operations.</span>.</p> 411 409 412 410 <p>You derive your sender-side class from <code>pb.Cacheable</code>, and you 413 411 add two methods: <code class="API" -
doc/core/development/policy/coding-standard.xhtml
460 460 imported directly into the user's namespace and not cause 461 461 confusion.</p> 462 462 463 <h3>New-style Classes</h3>464 465 <p>Classes and instances in Python come in two flavors: old-style or466 classic, and new-style. Up to Python 2.1, old-style classes were the467 only flavour available to the user, new-style classes were introduced468 in Python 2.2 to unify classes and types. All classes added to Twisted469 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 473 463 <h2>Methods</h2> 474 464 475 465 <p>Methods should be in mixed case, with the first letter lower -
doc/web/howto/xmlrpc.xhtml
15 15 <p><a href="http://www.xmlrpc.com">XML-RPC</a> is a simple request/reply protocol 16 16 that runs over HTTP. It is simple, easy to implement and supported by most programming 17 17 languages. 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> 20 19 21 20 <h2>Creating a XML-RPC server</h2> 22 21 -
doc/web/examples/xmlrpc.py
21 21 22 22 from twisted.web import xmlrpc 23 23 from twisted.internet import defer 24 25 # This module is standard in Python 2.2, otherwise get it from26 # http://www.pythonware.com/products/xmlrpc/27 24 import xmlrpclib 28 25 29 26
