[Zope-Checkins] SVN: Zope/trunk/ merge from
svn+ssh://andreasjung@svn.zope.org/repos/main/Zope/z212-deprecation-cleanup
Andreas Jung
andreas at andreas-jung.com
Mon Jun 30 15:27:25 EDT 2008
Log message for revision 87866:
merge from svn+ssh://andreasjung@svn.zope.org/repos/main/Zope/z212-deprecation-cleanup
Changed:
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/lib/python/OFS/OrderSupport.py
U Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py
U Zope/trunk/lib/python/Products/ZCatalog/__init__.py
D Zope/trunk/lib/python/StructuredText/
D Zope/trunk/lib/python/TAL/
D Zope/trunk/lib/python/ZTUtils/Iterator.py
D Zope/trunk/lib/python/ZTUtils/tests/testIterator.py
U Zope/trunk/lib/python/webdav/Resource.py
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2008-06-30 19:09:42 UTC (rev 87865)
+++ Zope/trunk/doc/CHANGES.txt 2008-06-30 19:27:24 UTC (rev 87866)
@@ -9,6 +9,12 @@
Restructuring
+ - Removed deprecated ZTUtil.Iterator module
+
+ - Removed deprecated StructuredText module
+
+ - Removed deprecated TAL module
+
- Removed deprecated modules from Products.PageTemplates.
- Removed deprecated ZCML directives from Five including the whole
@@ -465,7 +471,7 @@
the 'logging' module
- PluginIndexes/TextIndex is deprecated. Use ZCTextIndex instead
-
+
- the 'StructuredText' module is deprecated. Use zope.structuredtext
instead
Modified: Zope/trunk/lib/python/OFS/OrderSupport.py
===================================================================
--- Zope/trunk/lib/python/OFS/OrderSupport.py 2008-06-30 19:09:42 UTC (rev 87865)
+++ Zope/trunk/lib/python/OFS/OrderSupport.py 2008-06-30 19:27:24 UTC (rev 87866)
@@ -261,16 +261,8 @@
old_position = self.getObjectPosition(id)
result = super(OrderSupport, self).manage_renameObject(id, new_id,
REQUEST)
- try:
- self.moveObjectToPosition(new_id, old_position,
- suppress_events=True)
- except TypeError:
- # BBB: removed in Zope 2.11
- self.moveObjectToPosition(new_id, old_position)
- warnings.warn(
- "%s.moveObjectToPosition without suppress_events is "
- "deprecated and will be removed in Zope 2.11." %
- self.__class__.__name__, DeprecationWarning)
+ self.moveObjectToPosition(new_id, old_position,
+ suppress_events=True)
return result
def tpValues(self):
Modified: Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py 2008-06-30 19:09:42 UTC (rev 87865)
+++ Zope/trunk/lib/python/Products/ZCatalog/ZCatalog.py 2008-06-30 19:27:24 UTC (rev 87866)
@@ -504,15 +504,6 @@
'?manage_tabs_message=Reindexing%20Performed')
- # BBB: will be removed in Zope 2.12 (like TextIndex itself)
- security.declareProtected(manage_zcatalog_entries, 'availableSplitters')
- def availableSplitters(self):
- """ splitter we can add """
- # This import will trigger a deprecation warning about TextIndex
- from Products.PluginIndexes.TextIndex import Splitter
- return Splitter.availableSplitters
-
-
security.declareProtected(manage_zcatalog_entries, 'catalog_object')
def catalog_object(self, obj, uid=None, idxs=None, update_metadata=1, pghandler=None):
""" wrapper around catalog """
Modified: Zope/trunk/lib/python/Products/ZCatalog/__init__.py
===================================================================
--- Zope/trunk/lib/python/Products/ZCatalog/__init__.py 2008-06-30 19:09:42 UTC (rev 87865)
+++ Zope/trunk/lib/python/Products/ZCatalog/__init__.py 2008-06-30 19:27:24 UTC (rev 87866)
@@ -14,7 +14,6 @@
"""ZCatalog product"""
import ZCatalog, CatalogAwareness, CatalogPathAwareness
-from Products.PluginIndexes.TextIndex import Vocabulary
# BBB: ZClasses are deprecated but we don't want the warning to appear here
import warnings
@@ -44,13 +43,6 @@
icon='www/ZCatalog.gif',
)
- context.registerClass(
- Vocabulary.Vocabulary,
- permission='Add Vocabularies',
- constructors=(Vocabulary.manage_addVocabularyForm,
- Vocabulary.manage_addVocabulary),
- icon='www/Vocabulary.gif',
- )
context.registerHelp()
context.registerHelpTitle('Zope Help')
Deleted: Zope/trunk/lib/python/ZTUtils/Iterator.py
===================================================================
--- Zope/trunk/lib/python/ZTUtils/Iterator.py 2008-06-30 19:09:42 UTC (rev 87865)
+++ Zope/trunk/lib/python/ZTUtils/Iterator.py 2008-06-30 19:27:24 UTC (rev 87866)
@@ -1,176 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
-#
-##############################################################################
-"""Iterator class
-
-BBB 2005/05/01 -- to be removed after 12 months
-
-$Id$
-"""
-import zope.deprecation
-zope.deprecation.deprecated(
- 'Iterator',
- 'Iterator has been deprecated and will be removed in Zope 2.12. '
- 'PageTemplates now use the Zope 3 implementation. Use ZopeIterator '
- 'from Products.PageTemplates.Expressions instead.'
- )
-
-class Iterator:
- '''Simple Iterator class'''
-
- __allow_access_to_unprotected_subobjects__ = 1
-
- nextIndex = 0
- def __init__(self, seq):
- self.seq = seq
- if iterInner._supports(seq, self):
- self._inner = iterInner
- self._prep_next = iterInner.prep_next
- return
- raise TypeError, "Iterator does not support %s" % `seq`
-
- def __getattr__(self, name):
- try:
- inner = getattr(self._inner, 'it_' + name)
- except AttributeError:
- raise AttributeError, name
- return inner(self)
-
- def next(self):
- if not (hasattr(self, '_next') or self._prep_next(self)):
- return 0
- self.index = i = self.nextIndex
- self.nextIndex = i+1
- self._advance(self)
- return 1
-
- def _advance(self, it):
- self.item = self._next
- del self._next
- del self.end
- self._advance = self._inner.advance
- self.start = 1
-
- def number(self): return self.nextIndex
-
- def even(self): return not self.index % 2
-
- def odd(self): return self.index % 2
-
- def parity(self):
- if self.index % 2:
- return 'odd'
- return 'even'
-
- def letter(self, base=ord('a'), radix=26):
- index = self.index
- s = ''
- while 1:
- index, off = divmod(index, radix)
- s = chr(base + off) + s
- if not index: return s
-
- def Letter(self):
- return self.letter(base=ord('A'))
-
- def Roman(self, rnvalues=(
- (1000,'M'),(900,'CM'),(500,'D'),(400,'CD'),
- (100,'C'),(90,'XC'),(50,'L'),(40,'XL'),
- (10,'X'),(9,'IX'),(5,'V'),(4,'IV'),(1,'I')) ):
- n = self.index + 1
- s = ''
- for v, r in rnvalues:
- rct, n = divmod(n, v)
- s = s + r * rct
- return s
-
- def roman(self):
- return self.Roman().lower()
-
- def first(self, name=None):
- if self.start: return 1
- return not self.same_part(name, self._last, self.item)
-
- def last(self, name=None):
- if self.end: return 1
- return not self.same_part(name, self.item, self._next)
-
- def length(self):
- return len(self.seq)
-
- def same_part(self, name, ob1, ob2):
- if name is None:
- return ob1 == ob2
- no = []
- return getattr(ob1, name, no) == getattr(ob2, name, no) is not no
-
- def __iter__(self):
- return IterIter(self)
-
-class InnerBase:
- '''Base Inner class for Iterators'''
- # Prep sets up ._next and .end
- def prep_next(self, it):
- it.next = self.no_next
- it.end = 1
- return 0
-
- # Advance knocks them down
- def advance(self, it):
- it._last = it.item
- it.item = it._next
- del it._next
- del it.end
- it.start = 0
-
- def no_next(self, it):
- return 0
-
- def it_end(self, it):
- if hasattr(it, '_next'):
- return 0
- return not self.prep_next(it)
-
-class IterInner(InnerBase):
- '''Iterator inner class for objects with Python iterators'''
-
- def _supports(self, ob, it):
- try:
- it.iter = iter(ob)
- return 1
- except:
- return 0
-
- def prep_next(self, it):
- try:
- it._next = it.iter.next()
- except StopIteration:
- it._prep_next = self.no_next
- it.end = 1
- return 0
- it.end = 0
- return 1
-
-class IterIter:
- def __init__(self, it):
- self.it = it
- self.skip = it.nextIndex > 0 and not it.end
- def next(self):
- it = self.it
- if self.skip:
- self.skip = 0
- return it.item
- if it.next():
- return it.item
- raise StopIteration
-
-iterInner = IterInner()
Deleted: Zope/trunk/lib/python/ZTUtils/tests/testIterator.py
===================================================================
--- Zope/trunk/lib/python/ZTUtils/tests/testIterator.py 2008-06-30 19:09:42 UTC (rev 87865)
+++ Zope/trunk/lib/python/ZTUtils/tests/testIterator.py 2008-06-30 19:27:24 UTC (rev 87866)
@@ -1,148 +0,0 @@
-from __future__ import generators
-import os, sys, unittest
-
-import zope.deprecation
-zope.deprecation.__show__.off()
-from ZTUtils import Iterator
-zope.deprecation.__show__.on()
-
-try:
- iter
- do_piter_test = 1
-except NameError:
- do_piter_test = 0
-
-class itemIterator:
- 'Ignore the __getitem__ argument in order to catch non-monotonic access.'
- def __init__(self, n):
- self.n = n
- self.i = 0
- def __getitem__(self, i):
- if self.i >= self.n:
- raise IndexError
- i = self.i
- self.i = self.i + 1
- return i
-
-class genIterator:
- 'Generator-based iteration'
- def __init__(self, n):
- self.n = n
- def __iter__(self):
- for i in range(self.n):
- yield i
-
-class IteratorTests(unittest.TestCase):
-
- def testIterator0(self):
- it = Iterator(())
- assert not it.next(), "Empty iterator"
-
- def testIterator1(self):
- it = Iterator((1,))
- assert it.next() and not it.next(), "Single-element iterator"
-
- def testIteratorMany(self):
- it = Iterator('text')
- for c in 'text':
- assert it.next(), "Multi-element iterator"
- assert not it.next(), "Multi-element iterator"
-
- def testStart(self):
- for size in range(4):
- it = Iterator(range(size+1))
- it.next()
- assert it.start, "Start true on element 1 of %s" % (size + 1)
- el = 1
- while it.next():
- el = el + 1
- assert not it.start, (
- "Start false on element %s of %s" % (el, size+1))
-
- def testEnd(self):
- for size in range(4):
- size = size + 1
- it = Iterator(range(size))
- el = 0
- while it.next():
- el = el + 1
- if el == size:
- assert it.end, "End true on element %s" % size
- else:
- assert not it.end, (
- "End false on element %s of %s" % (el, size))
-
- def assertRangeMatch(self, ob, n):
- it = Iterator(ob)
- for el in range(n):
- assert it.next(), "Iterator stopped too soon"
- assert it.index == el, "Incorrect index"
- assert it.number() == el + 1, "Incorrect number"
- assert it.item == el, "Incorrect item"
-
- def testIndex(self):
- self.assertRangeMatch(range(5), 5)
- self.assertRangeMatch((0,1,2,3,4), 5)
- self.assertRangeMatch({0:0, 1:1, 2:2, 3:3, 4:4}, 5)
- self.assertRangeMatch(itemIterator(5), 5)
- self.assertRangeMatch(genIterator(5), 5)
-
- def testFirstLast(self):
- it = Iterator([1])
- it.next()
- assert it.first() == it.last() == 1, "Bad first/last on singleton"
- four = range(4)
- for a in 2,3:
- for b in four:
- for c in four:
- s = 'a' * a + 'b' * b + 'c' * c
- it = Iterator(s)
- it.next()
- assert it.first(), "First element not first()"
- last = s[0]
- lastlast = it.last()
- while it.next():
- assert ((it.item != last) == it.first()), (
- "first() error")
- assert ((it.item != last) == lastlast), (
- "last() error" % (it.item,
- last, lastlast))
- last = it.item
- lastlast = it.last()
- assert lastlast, "Last element not last()"
-
- if do_piter_test:
- def testIterOfIter(self):
- for i in range(4):
- r = range(i)
- it1 = Iterator(r)
- it2 = Iterator(iter(r))
- while it1.next() and it2.next():
- assert it1.item == it2.item, "Item mismatch with iter()"
- assert it1.index == it2.index, (
- "Index mismatch with iter()")
- assert not (it1.next() or it2.next()), (
- "Length mismatch with iter()")
-
- def testIterIter(self):
- wo_iter = map(lambda x:(x, x), range(4))
- for i in range(4):
- r = range(i)
- w_iter = []
- it = Iterator(r)
- for x in it:
- w_iter.append((x, it.index))
- assert w_iter == wo_iter[:i], (
- "for-loop failure on full iterator")
- it = Iterator(range(4))
- it.next(); it.next(); it.next()
- w_iter = []
- for x in it:
- w_iter.append((x, it.index))
- assert w_iter == wo_iter[2:], "for-loop failure on half iteration"
-
-def test_suite():
- return unittest.makeSuite(IteratorTests)
-
-if __name__=='__main__':
- main()
Modified: Zope/trunk/lib/python/webdav/Resource.py
===================================================================
--- Zope/trunk/lib/python/webdav/Resource.py 2008-06-30 19:09:42 UTC (rev 87865)
+++ Zope/trunk/lib/python/webdav/Resource.py 2008-06-30 19:27:24 UTC (rev 87866)
@@ -535,30 +535,14 @@
ob = self._getCopy(parent)
ob._setId(name)
- try:
- orig_container._delObject(orig_id, suppress_events=True)
- except TypeError:
- # BBB: removed in Zope 2.11
- orig_container._delObject(orig_id)
- warnings.warn(
- "%s._delObject without suppress_events is deprecated "
- "and will be removed in Zope 2.11." %
- orig_container.__class__.__name__, DeprecationWarning)
+ orig_container._delObject(orig_id, suppress_events=True)
if existing:
object=getattr(parent, name)
self.dav__validate(object, 'DELETE', REQUEST)
parent._delObject(name)
- try:
- parent._setObject(name, ob, set_owner=0, suppress_events=True)
- except TypeError:
- # BBB: removed in Zope 2.11
- parent._setObject(name, ob, set_owner=0)
- warnings.warn(
- "%s._setObject without suppress_events is deprecated "
- "and will be removed in Zope 2.11." %
- parent.__class__.__name__, DeprecationWarning)
+ parent._setObject(name, ob, set_owner=0, suppress_events=True)
ob = parent._getOb(name)
notify(ObjectMovedEvent(ob, orig_container, orig_id, parent, name))
More information about the Zope-Checkins
mailing list