Ticket #5451: patch_5451.2.patch
| File patch_5451.2.patch, 5.1 KB (added by moijes12, 17 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), "", "twisted.python.reflect", "Settable") 49 47 50 def __init__(self, **kw): 48 51 self(**kw) 49 52 … … 75 78 76 79 """ 77 80 81 deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), "", "twisted.python.reflect", "AccessorType") 82 78 83 def __init__(self, name, bases, d): 79 84 type.__init__(self, name, bases, d) 80 85 accessors = {} … … 138 143 # caused by it. 139 144 # -- itamar 140 145 146 deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), "", "twisted.python.reflect", "PropertyAccessor") 141 147 __metaclass__ = AccessorType 142 148 143 149 def reallySet(self, k, v): … … 159 165 This implementation is for Python 2.1. 160 166 """ 161 167 168 deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), "", "twisted.python.reflect", "Accessor") 169 162 170 def __setattr__(self, k,v): 163 171 kstring='set_%s'%k 164 172 if hasattr(self.__class__,kstring): … … 199 207 200 208 # just in case 201 209 OriginalAccessor = Accessor 202 210 deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), "", "twisted.python.reflect", "OriginalAccessor") 203 211 204 212 class Summer(Accessor): 205 213 """ … … 214 222 incremented, similiarly for the debit versions. 215 223 """ 216 224 225 deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), "", "twisted.python.reflect", "Summer") 226 217 227 def reallySet(self, k,v): 218 228 "This method does the work." 219 229 for sum in self.sums: -
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 -
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 test_settable(self): 786 """ 787 Test deprecation of L{reflect.Settable} 788 """ 789 settable = reflect.Settable() 790 warnings = self.flushWarnings([self.test_settable]) 791 self.assertSubstring("twisted.python.reflect.Settable was deprecated in Twisted 12.1.0", warnings[0]['message']) 792 self.assertEqual(len(warnings),1) 793 794 def test_accessorType(self): 795 """ 796 Test deprecation of L{reflect.AccessorType} 797 """ 798 accessorType = reflect.AccessorType('', (), {}) 799 warnings = self.flushWarnings([self.test_accessorType]) 800 self.assertSubstring("twisted.python.reflect.AccessorType was deprecated in Twisted 12.1.0", warnings[0]['message']) 801 self.assertEqual(len(warnings),1) 802 803 def test_propertyAccessor(self): 804 """ 805 Test deprecation of L{reflect.PropertyAccessor} 806 """ 807 accessorType = reflect.PropertyAccessor() 808 warnings = self.flushWarnings([self.test_propertyAccessor]) 809 self.assertSubstring("twisted.python.reflect.PropertyAccessor was deprecated in Twisted 12.1.0", warnings[0]['message']) 810 self.assertEqual(len(warnings),1) 811 812 def test_accessor(self): 813 """ 814 Test deprecation of L{reflect.Accessor} 815 """ 816 accessorType = reflect.Accessor() 817 warnings = self.flushWarnings([self.test_accessor]) 818 self.assertSubstring("twisted.python.reflect.Accessor was deprecated in Twisted 12.1.0", warnings[0]['message']) 819 self.assertEqual(len(warnings),1) 820 821 def test_originalAccessor(self): 822 """ 823 Test deprecation of L{reflect.OriginalAccessor} 824 """ 825 from twisted.python.reflect import OriginalAccessor 826 warnings = self.flushWarnings([self.test_originalAccessor]) 827 self.assertSubstring("twisted.python.reflect.OriginalAccessor was deprecated in Twisted 12.1.0", warnings[0]['message']) 828 self.assertEqual(len(warnings),1) 829 830 def test_summer(self): 831 """ 832 Test deprecation of L{reflect.Summer} 833 """ 834 accessorType = reflect.Summer() 835 warnings = self.flushWarnings([self.test_summer]) 836 self.assertSubstring("twisted.python.reflect.Summer was deprecated in Twisted 12.1.0", warnings[0]['message']) 837 self.assertEqual(len(warnings),1) 838 No newline at end of file
