Ticket #5451: Twisted_5451.patch
| File Twisted_5451.patch, 6.5 KB (added by moijes12, 16 months ago) |
|---|
-
twisted/python/reflect.py
30 30 from StringIO import StringIO 31 31 32 32 from twisted.python.util import unsignedID 33 from twisted.python.deprecate import deprecated 33 from twisted.python.deprecate import deprecated, deprecatedModuleAttribute 34 34 from twisted.python.deprecate import _fullyQualifiedName as fullyQualifiedName 35 35 from twisted.python.versions import Version 36 36 … … 44 44 where you don't want to name a variable, but you do want to set 45 45 some attributes; for example, C{X()(y=z,a=b)}. 46 46 """ 47 48 deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), 49 "Settable is an implementation for Python 2.2 and earlier which are no " 50 "longer supported by Twisted.", "twisted.python.reflect", "Settable") 51 47 52 def __init__(self, **kw): 48 53 self(**kw) 49 54 … … 75 80 76 81 """ 77 82 83 deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), 84 "AccessorType is an implementation for Python 2.2 which is no longer " 85 "supported by Twisted.", "twisted.python.reflect", "AccessorType") 86 78 87 def __init__(self, name, bases, d): 79 88 type.__init__(self, name, bases, d) 80 89 accessors = {} … … 138 147 # caused by it. 139 148 # -- itamar 140 149 150 deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), 151 "PropertyAccessor is an implementation for Python 2.2 and earlier which " 152 "are no longer supported by Twisted.","twisted.python.reflect", 153 "PropertyAccessor") 141 154 __metaclass__ = AccessorType 142 155 143 156 def reallySet(self, k, v): … … 159 172 This implementation is for Python 2.1. 160 173 """ 161 174 175 deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), 176 "Accessor is an implementation for Python 2.1 which is no longer " 177 "supported by Twisted.", "twisted.python.reflect", "Accessor") 178 162 179 def __setattr__(self, k,v): 163 180 kstring='set_%s'%k 164 181 if hasattr(self.__class__,kstring): … … 199 216 200 217 # just in case 201 218 OriginalAccessor = Accessor 219 deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), 220 "OriginalAccessor is a reference to class twisted.python.reflect.Accessor " 221 "which is deprecated.", "twisted.python.reflect", "OriginalAccessor") 202 222 203 223 204 224 class Summer(Accessor): … … 214 234 incremented, similiarly for the debit versions. 215 235 """ 216 236 237 deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), 238 "Summer is a child class of twisted.python.reflect.Accessor which is " 239 "deprecated.", "twisted.python.reflect", "Summer") 240 217 241 def reallySet(self, k,v): 218 242 "This method does the work." 219 243 for sum in self.sums: -
twisted/test/test_reflect.py
781 781 self.callDeprecated( 782 782 (Version("Twisted", 11, 0, 0), "inspect.getmro"), 783 783 reflect.accumulateBases, DeprecationTestCase, l, None) 784 785 def lookForDeprecationWarning(self, testMethod, attributeName, warningMsg): 786 """ 787 Test deprecation of attribute 'reflect.attributeName' by calling 788 'reflect.testMethod' and verifying the warning message 789 'reflect.warningMsg' 790 791 @param testMethod : Name of the offending function to be used with 792 flushWarnings 793 @type testmethod : C{str} 794 795 @param attributeName : Name of attribute to be checked for deprecation 796 @type attributeName : C{str} 797 798 @param warningMsg : Deprecation warning message 799 @type warningMsg : C{str} 800 """ 801 warningsShown = self.flushWarnings([testMethod]) 802 self.assertEqual(len(warningsShown), 1) 803 self.assertIdentical(warningsShown[0]['category'], DeprecationWarning) 804 self.assertEqual( 805 warningsShown[0]['message'], 806 "twisted.python.reflect." + attributeName + " " 807 "was deprecated in Twisted 12.1.0: " + warningMsg + ".") 808 809 def test_settable(self): 810 """ 811 Test deprecation of L{reflect.Settable} 812 """ 813 reflect.Settable() 814 self.lookForDeprecationWarning(self.test_settable, "Settable", 815 "Settable is an implementation for Python 2.2 and earlier which " 816 "are no longer supported by Twisted") 817 818 def test_accessorType(self): 819 """ 820 Test deprecation of L{reflect.AccessorType} 821 """ 822 reflect.AccessorType(' ', ( ), { }) 823 self.lookForDeprecationWarning(self.test_accessorType, "AccessorType", 824 "AccessorType is an implementation for " 825 "Python 2.2 which is no longer supported by Twisted") 826 827 def test_propertyAccessor(self): 828 """ 829 Test deprecation of L{reflect.PropertyAccessor} 830 """ 831 reflect.PropertyAccessor() 832 self.lookForDeprecationWarning(self.test_propertyAccessor, 833 "PropertyAccessor", 834 "PropertyAccessor is an implementation for Python 2.2 and earlier" 835 " which are no longer supported by Twisted") 836 837 def test_accessor(self): 838 """ 839 Test deprecation of L{reflect.Accessor} 840 """ 841 reflect.Accessor() 842 self.lookForDeprecationWarning(self.test_accessor, "Accessor", 843 "Accessor is an implementation for Python 2.1 which is no longer " 844 "supported by Twisted") 845 846 def test_originalAccessor(self): 847 """ 848 Test deprecation of L{reflect.OriginalAccessor} 849 """ 850 reflect.OriginalAccessor() 851 self.lookForDeprecationWarning(self.test_originalAccessor, 852 "OriginalAccessor", "OriginalAccessor is a reference to class " 853 "twisted.python.reflect.Accessor which is deprecated") 854 855 def test_summer(self): 856 """ 857 Test deprecation of L{reflect.Summer} 858 """ 859 reflect.Summer() 860 self.lookForDeprecationWarning(self.test_summer, "Summer", 861 "Summer is a child class of twisted.python.reflect.Accessor which" 862 " is deprecated") 863 No newline at end of file -
twisted/topfiles/5451.removal
1 twisted.python.reflect's Settable, AccessorType, PropertyAccessor, Accessor, OriginalAccessor and Summer are now deprecated. 2 No newline at end of file
