Having an orphan size, higher than batch size is undefined

Running the latest stable version on Ubuntu 14.04 and getting the following error at certain areas of the site.

Please advise, thanks in advance.

Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Products.CMFPlone.FactoryTool, line 478, in call
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module Products.CMFFormController.FSControllerPageTemplate, line 91, in call
Module Products.CMFFormController.BaseControllerPageTemplate, line 31, in _call
Module Shared.DC.Scripts.Bindings, line 322, in call
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.CMFCore.FSPageTemplate, line 237, in _exec
Module Products.CMFCore.FSPageTemplate, line 177, in pt_render
Module Products.PageTemplates.PageTemplate, line 79, in pt_render
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Warning: Macro expansion failed
Warning: <type 'exceptions.KeyError'>: 'macro'
Module zope.pagetemplate.pagetemplate, line 240, in call
Module zope.tal.talinterpreter, line 271, in call
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 946, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 858, in do_defineMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 852, in do_condition
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 954, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 852, in do_condition
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 821, in do_loop_tal
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 522, in do_optTag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 821, in do_loop_tal
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 852, in do_condition
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 852, in do_condition
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 946, in do_defineSlot
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
Module Products.PageTemplates.Expressions, line 218, in evaluateStructure
Module zope.tales.tales, line 696, in evaluate
URL: file:/home/bika/Plone/buildout-cache/eggs/bika.lims-3.1.8.1-py2.7.egg/bika/lims/skins/bika/bika_widgets/analysisprofileanalyseswidget.pt
Line 20, Column 3
Expression: <PythonExpr widget.Analyses(field, allow_edit=True)>
Names:
{'container': <PloneSite at /CR-01>,
'context': <AnalysisProfile at /CR-01/bika_setup/bika_analysisprofiles/portal_factory/AnalysisProfile/analysisprofile.2015-07-03.7037896042 used for /CR-01/bika_setup/bika_analysisprofiles>,
'default': <object object at 0xb7542820>,
'here': <AnalysisProfile at /CR-01/bika_setup/bika_analysisprofiles/portal_factory/AnalysisProfile/analysisprofile.2015-07-03.7037896042 used for /CR-01/bika_setup/bika_analysisprofiles>,
'loop': {u'field': <Products.PageTemplates.Expressions.PathIterator object at 0xafeb00cc>,
u'fieldset': <Products.PageTemplates.Expressions.PathIterator object at 0xafea254c>},
'nothing': None,
'options': {'args': (),
'state': <Products.CMFFormController.ControllerState.ControllerState object at 0xafe9224c>},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xafebf3ec>,
'request': <HTTPRequest, URL=http://192.168.227.128:8080/CR-01/bika_setup/bika_analysisprofiles/portal_factory/AnalysisProfile/analysisprofile.2015-07-03.7037896042/base_edit>,
'root': ,
'template': <FSControllerPageTemplate at /CR-01/base_edit used for /CR-01/bika_setup/bika_analysisprofiles/portal_factory/AnalysisProfile/analysisprofile.2015-07-03.7037896042>,
'traverse_subpath': ,
'user': <PropertiedUser 'admin'>}
Module Products.PageTemplates.ZRPythonExpr, line 48, in call
traceback_info: widget.Analyses(field, allow_edit=True)
Module PythonExpr, line 1, in
Module bika.lims.browser.widgets.analysisprofileanalyseswidget, line 183, in Analyses
Module bika.lims.browser.bika_listing, line 787, in contents_table
Module Products.Five.browser.pagetemplatefile, line 125, in call
Module Products.Five.browser.pagetemplatefile, line 59, in call
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module zope.pagetemplate.pagetemplate, line 240, in call
Module zope.tal.talinterpreter, line 271, in call
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 531, in do_optTag_tal
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 531, in do_optTag_tal
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 583, in do_setLocal_tal
Module zope.tales.tales, line 696, in evaluate
URL: /home/bika/Plone/buildout-cache/eggs/bika.lims-3.1.8.1-py2.7.egg/bika/lims/browser/templates/bika_listing_table.pt
Line 184, Column 4
Expression: <PythonExpr ( view.bika_listing.selected_cats(view.batch))>
Names:
{'args': (<bika.lims.browser.widgets.analysisprofileanalyseswidget.AnalysisProfileAnalysesView object at 0xafeb08cc>,),
'container': <bika.lims.browser.widgets.analysisprofileanalyseswidget.AnalysisProfileAnalysesWidget object at 0xb30105ac>,
'context': <bika.lims.browser.widgets.analysisprofileanalyseswidget.AnalysisProfileAnalysesWidget object at 0xb30105ac>,
'default': <object object at 0xb7542820>,
'here': <bika.lims.browser.widgets.analysisprofileanalyseswidget.AnalysisProfileAnalysesWidget object at 0xb30105ac>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xafef1af4>,
'request': <HTTPRequest, URL=http://192.168.227.128:8080/CR-01/bika_setup/bika_analysisprofiles/portal_factory/AnalysisProfile/analysisprofile.2015-07-03.7037896042/base_edit>,
'root': ,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xb1f74cec>,
'traverse_subpath': ,
'user': <PropertiedUser 'admin'>,
'view': <bika.lims.browser.bika_listing.BikaListingTable object at 0xafea258c>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0xafe9874c>}
Module zope.tales.pythonexpr, line 59, in call
traceback_info: ( view.bika_listing.selected_cats(view.batch))
Module , line 1, in
Module plone.memoize.instance, line 51, in memogetter
Module plone.app.content.browser.tableview, line 95, in batch
Module plone.batching.batch, line 96, in fromPagenumber
Module plone.batching.batch, line 34, in init
AssertionError: Having an orphan size, higher than batch size is undefined

Looks like you specifed an orhpan size larger than the batch size.

i had the same errors after updating to plone 4.3.6. looks like this is due to some changes in plone.app.batch.

i added a comment to the lines that cause the problem.

for me it looks like the assertion does not make sense. calling batch on a list with length 0 (which almost certainly will be < orphans) should not lead to a site error

I am going to change the assertion to allow equal size of batch size and orphan size. This will properly handle the 0, 0 edge case

There is now plone.batching 1.0.5 with which this problem should not occur any more. Also, better grammar, I think.