Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
7b6791eb
Commit
7b6791eb
authored
Feb 15, 2002
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge fixes from Zope-2_5-branch.
parent
017c4630
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
lib/python/ZTUtils/Batch.py
lib/python/ZTUtils/Batch.py
+17
-3
lib/python/ZTUtils/Zope.py
lib/python/ZTUtils/Zope.py
+3
-3
No files found.
lib/python/ZTUtils/Batch.py
View file @
7b6791eb
...
...
@@ -12,15 +12,15 @@
##############################################################################
__doc__
=
'''Batch class, for iterating over a sequence in batches
$Id: Batch.py,v 1.
6 2001/11/28 15:51:22 matt
Exp $'''
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
$Id: Batch.py,v 1.
7 2002/02/15 16:26:56 evan
Exp $'''
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
from
ExtensionClass
import
Base
class
LazyPrevBatch
(
Base
):
def
__of__
(
self
,
parent
):
return
Batch
(
parent
.
_sequence
,
parent
.
_size
,
-
1
,
parent
.
first
+
parent
.
overlap
,
parent
.
first
-
parent
.
_size
+
parent
.
overlap
,
0
,
parent
.
orphan
,
parent
.
overlap
)
class
LazyNextBatch
(
Base
):
...
...
@@ -40,6 +40,20 @@ class Batch(Base):
def
__init__
(
self
,
sequence
,
size
,
start
=
0
,
end
=
0
,
orphan
=
0
,
overlap
=
0
):
'''Encapsulate "sequence" in batches of "size".
Arguments: "start" and "end" are 0-based indexes into the
sequence. If the next batch would contain no more than
"orphan" elements, it is combined with the current batch.
"overlap" is the number of elements shared by adjacent
batches. If "size" is not specified, it is computed from
"start" and "end". Failing that, it is 7.
Attributes: Note that the "start" attribute, unlike the
argument, is a 1-based index (I know, lame). "first" is the
0-based index. "length" is the actual number of elements in
the batch.
'''
start
=
start
+
1
...
...
lib/python/ZTUtils/Zope.py
View file @
7b6791eb
...
...
@@ -12,8 +12,8 @@
##############################################################################
__doc__
=
'''Zope-specific versions of ZTUTils classes
$Id: Zope.py,v 1.
7 2001/11/28 15:51:22 matt
Exp $'''
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
$Id: Zope.py,v 1.
8 2002/02/15 16:26:56 evan
Exp $'''
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
import
sys
,
cgi
,
urllib
,
cgi
from
Tree
import
encodeExpansion
,
decodeExpansion
,
TreeMaker
...
...
@@ -141,7 +141,7 @@ class SimpleTreeMaker(TreeSkipMixin, SimpleTreeMaker):
_Batch
=
Batch
class
Batch
(
Batch
):
def
__init__
(
self
,
sequence
,
size
,
start
=
0
,
end
=
0
,
orphan
=
3
,
overlap
=
0
,
skip_unauthorized
=
None
):
orphan
=
0
,
overlap
=
0
,
skip_unauthorized
=
None
):
sequence
=
LazyFilter
(
sequence
,
skip
=
skip_unauthorized
)
_Batch
.
__init__
(
self
,
sequence
,
size
,
start
,
end
,
orphan
,
overlap
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment