[ZPT] CVS: Zope/lib/python/ZTUtils - Batch.py:1.10 Iterator.py:1.7 SimpleTree.py:1.3 Tree.py:1.6 Zope.py:1.10 __init__.py:1.6
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 18:10:13 -0400
Update of /cvs-repository/Zope/lib/python/ZTUtils
In directory cvs.zope.org:/tmp/cvs-serv21051
Modified Files:
Batch.py Iterator.py SimpleTree.py Tree.py Zope.py __init__.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/ZTUtils/Batch.py 1.9 => 1.10 ===
--- Zope/lib/python/ZTUtils/Batch.py:1.9 Fri Mar 15 16:47:38 2002
+++ Zope/lib/python/ZTUtils/Batch.py Wed Aug 14 18:10:12 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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
-#
+#
##############################################################################
__doc__='''Batch class, for iterating over a sequence in batches
@@ -43,7 +43,7 @@
previous = LazyPrevBatch()
next = LazyNextBatch()
sequence_length = LazySequenceLength()
-
+
def __init__(self, sequence, size, start=0, end=0,
orphan=0, overlap=0):
'''Encapsulate "sequence" in batches of "size".
@@ -78,13 +78,13 @@
self.length = self.end - self.first
if self.first == 0:
self.previous = None
-
-
+
+
def __getitem__(self, index):
if index < 0:
if index + self.end < self.first: raise IndexError, index
return self._sequence[index + self.end]
-
+
if index >= self.length: raise IndexError, index
return self._sequence[index+self.first]
=== Zope/lib/python/ZTUtils/Iterator.py 1.6 => 1.7 ===
--- Zope/lib/python/ZTUtils/Iterator.py:1.6 Fri Apr 19 10:16:08 2002
+++ Zope/lib/python/ZTUtils/Iterator.py Wed Aug 14 18:10:12 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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
-#
+#
##############################################################################
__doc__='''Iterator class
@@ -57,7 +57,7 @@
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
@@ -121,7 +121,7 @@
del it._next
del it.end
it.start = 0
-
+
def no_next(self, it):
return 0
=== Zope/lib/python/ZTUtils/SimpleTree.py 1.2 => 1.3 ===
--- Zope/lib/python/ZTUtils/SimpleTree.py:1.2 Wed Nov 28 10:51:22 2001
+++ Zope/lib/python/ZTUtils/SimpleTree.py Wed Aug 14 18:10:12 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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
-#
+#
##############################################################################
__doc__='''Simple Tree classes
@@ -38,7 +38,7 @@
return {'link': '?%s-setstate=%s,%s,%s#%s' % (pre, setst[0],
exnum, obid, obid),
'img': '<img src="%s/p_/%s" alt="%s" border="0">' % (base, img, setst)}
-
+
class SimpleTreeMaker(TreeMaker):
'''Generate Simple Trees'''
=== Zope/lib/python/ZTUtils/Tree.py 1.5 => 1.6 ===
--- Zope/lib/python/ZTUtils/Tree.py:1.5 Fri Apr 19 10:16:08 2002
+++ Zope/lib/python/ZTUtils/Tree.py Wed Aug 14 18:10:12 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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
-#
+#
##############################################################################
__doc__='''Tree manipulation classes
@@ -51,8 +51,8 @@
def __len__(self):
return len(self._child_list)
-_marker = []
-
+_marker = []
+
class TreeMaker:
'''Class for mapping a hierachy of objects into a tree of nodes.'''
@@ -81,7 +81,7 @@
self._values_filter = filter
else:
self._values_function = function
-
+
def tree(self, root, expanded=None, subtree=0):
'''Create a tree from root, with specified nodes expanded.
@@ -115,7 +115,7 @@
node.object = object
node.id = b2a(self.getId(object))
return node
-
+
def getId(self, object):
id_attr = self._id
if hasattr(object, id_attr):
@@ -196,7 +196,7 @@
node.expansion_number = n
n = n + 1
return ':'.join(steps)
-
+
def decodeExpansion(s, nth=None):
'''Decode an expanded node map from a string.
@@ -236,4 +236,3 @@
if nth_pair is not None:
return map, nth_pair
return map
-
=== Zope/lib/python/ZTUtils/Zope.py 1.9 => 1.10 ===
--- Zope/lib/python/ZTUtils/Zope.py:1.9 Fri Apr 19 10:16:08 2002
+++ Zope/lib/python/ZTUtils/Zope.py Wed Aug 14 18:10:12 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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
-#
+#
##############################################################################
__doc__='''Zope-specific versions of ZTUTils classes
@@ -44,9 +44,9 @@
self._data=[]
self._eindex=-1
self._test=test
- if not (skip is None or str(skip) == skip):
+ if not (skip is None or str(skip) == skip):
raise TypeError, 'Skip must be None or a string'
- self._skip = skip
+ self._skip = skip
def __getitem__(self,index):
data=self._data
@@ -148,7 +148,7 @@
# These functions are meant to be used together in templates that use
# trees or batches. For example, given a batch with a 'bstart' query
# argument, you would use "url_query(request, omit='bstart')" to get
-# the base for the batching links, then append
+# the base for the batching links, then append
# "make_query(bstart=batch.previous.first)" to one and
# "make_query(bstart=batch.end)" to the other.
@@ -177,8 +177,8 @@
k, m, v = qlist[i]
qlist[i] = '%s%s=%s' % (uq(k), m, uq(str(v)))
- return '&'.join(qlist)
-
+ return '&'.join(qlist)
+
def make_hidden_input(*args, **kwargs):
'''Construct a set of hidden input elements, with marshalling markup.
@@ -205,7 +205,7 @@
% (hq(k), m, hq(str(v))))
return '\n'.join(qlist)
-
+
def complex_marshal(pairs):
'''Add request marshalling information to a list of name-value pairs.
@@ -266,12 +266,12 @@
req_name: the name, such as "URL1" or "BASEPATH1", to get from request
omit: sequence of name of query arguments to omit. If a name
contains a colon, it is treated literally. Otherwise, it will
- match each argument name that starts with the name and a period or colon.
+ match each argument name that starts with the name and a period or colon.
'''
base = request[req_name]
qs = request.get('QUERY_STRING', '')
-
+
if qs and omit:
qsparts = qs.split('&')
@@ -294,7 +294,7 @@
name = name.split('.', 1)[0]
if omitted(name):
qsparts[i] = ''
-
+
qs = '&'.join(filter(None, qsparts))
# We alway append '?' since arguments will be appended to the URL
=== Zope/lib/python/ZTUtils/__init__.py 1.5 => 1.6 ===
--- Zope/lib/python/ZTUtils/__init__.py:1.5 Wed Nov 28 10:51:22 2001
+++ Zope/lib/python/ZTUtils/__init__.py Wed Aug 14 18:10:12 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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
-#
+#
##############################################################################
__doc__='''Package of template utility classes and functions.
@@ -28,4 +28,3 @@
from Zope import Batch, TreeMaker, SimpleTreeMaker, LazyFilter
from Zope import url_query, make_query, make_hidden_input
-