[Testbot] Plone 4.3 - Python 2.6 - Build # 2660 - Still failing! - 0 failure(s)

jenkins at plone.org jenkins at plone.org
Sat Jan 31 01:28:39 UTC 2015


-------------------------------------------------------------------------------
Plone 4.3 - Python 2.6 - Build # 2660 - Still Failing!
-------------------------------------------------------------------------------

http://jenkins.plone.org/job/plone-4.3-python-2.6/2660/


-------------------------------------------------------------------------------
CHANGES
-------------------------------------------------------------------------------

Repository: plone.batching
Branch: refs/heads/master
Date: 2015-01-27T20:10:02+01:00
Author: Patrick Gerken (do3cc) <do3cc at patrick-gerken.de>
Commit: https://github.com/plone/plone.batching/commit/d6b8296d95f6bf7b8a0467c5804f646fa48790ef

Fix issue with orphaning

Orphaning did not work...
Added a test and an assertion for funny folks
trying to have orphan ranges higher than batch size.

Files changed:
M CHANGES.rst
M plone/batching/batch.py
M plone/batching/tests.py

diff --git a/CHANGES.rst b/CHANGES.rst
index a2eb2dc..420d228 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,7 +4,8 @@ Changelog
 1.0.3 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Fix issue with orphaning
+  [do3cc]
 
 
 1.0.2 (2014-04-13)
diff --git a/plone/batching/batch.py b/plone/batching/batch.py
index c5e57d0..f6d3e87 100644
--- a/plone/batching/batch.py
+++ b/plone/batching/batch.py
@@ -31,6 +31,8 @@ def __init__(self, sequence, size, start=0, end=0, orphan=0, overlap=0,
         overlap   - the number of overlapping elements in each batch
         pagerange - the number of pages to display in the navigation
         """
+        assert orphan < size, "Having an orphan size, higher than batch size" \
+                              " is undefined"
         start += 1
         self._sequence = sequence
         self._size = size
@@ -155,7 +157,7 @@ def lastpage(self):
         """ Last page of batch
         """
         pages = self.sequence_length / self.pagesize
-        if self.sequence_length % self.pagesize:
+        if (self.sequence_length - self.orphan) % self.pagesize:
             pages += 1
         return pages
 
diff --git a/plone/batching/tests.py b/plone/batching/tests.py
index 3b442cc..5b92a44 100644
--- a/plone/batching/tests.py
+++ b/plone/batching/tests.py
@@ -97,6 +97,13 @@ def test_lastpage(self):
         lastbatch = BaseBatch(range(20), 5, start=batch.last)
         self.assertTrue(lastbatch.islastpage)
 
+    def test_lastpage_with_orphans(self):
+        batch = BaseBatch(range(11), 10, orphan=1)
+        self.assertEqual(1, batch.lastpage)
+        batch = BaseBatch(range(109), 10, orphan=9)
+        self.assertEqual(10, batch.lastpage)
+        self.assertRaises(AssertionError, BaseBatch, [], 10, orphan=20)
+
     def test_items_not_on_page(self):
         batch = BaseBatch(range(20), 5, start=5)
         self.assertEqual(batch.items_not_on_page,


Repository: plone.batching
Branch: refs/heads/master
Date: 2015-01-31T01:54:31+01:00
Author: Daniel Widerin (saily) <daniel at widerin.net>
Commit: https://github.com/plone/plone.batching/commit/697da305f5e8589c0121b537d2c8d37c74556745

Merge pull request #4 from plone/orphaning

Fix issue with orphaning

Files changed:
M CHANGES.rst
M plone/batching/batch.py
M plone/batching/tests.py

diff --git a/CHANGES.rst b/CHANGES.rst
index a2eb2dc..420d228 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,7 +4,8 @@ Changelog
 1.0.3 (unreleased)
 ------------------
 
-- Nothing changed yet.
+- Fix issue with orphaning
+  [do3cc]
 
 
 1.0.2 (2014-04-13)
diff --git a/plone/batching/batch.py b/plone/batching/batch.py
index c5e57d0..f6d3e87 100644
--- a/plone/batching/batch.py
+++ b/plone/batching/batch.py
@@ -31,6 +31,8 @@ def __init__(self, sequence, size, start=0, end=0, orphan=0, overlap=0,
         overlap   - the number of overlapping elements in each batch
         pagerange - the number of pages to display in the navigation
         """
+        assert orphan < size, "Having an orphan size, higher than batch size" \
+                              " is undefined"
         start += 1
         self._sequence = sequence
         self._size = size
@@ -155,7 +157,7 @@ def lastpage(self):
         """ Last page of batch
         """
         pages = self.sequence_length / self.pagesize
-        if self.sequence_length % self.pagesize:
+        if (self.sequence_length - self.orphan) % self.pagesize:
             pages += 1
         return pages
 
diff --git a/plone/batching/tests.py b/plone/batching/tests.py
index 3b442cc..5b92a44 100644
--- a/plone/batching/tests.py
+++ b/plone/batching/tests.py
@@ -97,6 +97,13 @@ def test_lastpage(self):
         lastbatch = BaseBatch(range(20), 5, start=batch.last)
         self.assertTrue(lastbatch.islastpage)
 
+    def test_lastpage_with_orphans(self):
+        batch = BaseBatch(range(11), 10, orphan=1)
+        self.assertEqual(1, batch.lastpage)
+        batch = BaseBatch(range(109), 10, orphan=9)
+        self.assertEqual(10, batch.lastpage)
+        self.assertRaises(AssertionError, BaseBatch, [], 10, orphan=20)
+
     def test_items_not_on_page(self):
         batch = BaseBatch(range(20), 5, start=5)
         self.assertEqual(batch.items_not_on_page,




-------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CHANGES.log
Type: application/octet-stream
Size: 4727 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20150131/51691484/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.log
Type: application/octet-stream
Size: 190348 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20150131/51691484/attachment-0003.obj>


More information about the Testbot mailing list