我刚升级到Plone 4.3,我得到这个错误:
ImportError: No module named batching
plone.app。Content不再提供批处理实现。
代替from plone.app.content.batching import Batch
try:
from plone.app.content.batching import Batch # Plone < 4.3
HAS_PLONE43 = False
except ImportError:
from plone.batching import Batch # Plone >= 4.3
HAS_PLONE43 = True
(编辑]
这两个实现有不同的API: pagesize
参数在plone.app.batching中被命名为size
;此外,需要一个起始索引而不是页码。
如果你有这样的代码
b = Batch(items,
pagesize=pagesize,
pagenumber=pagenumber)
用
代替 if HAS_PLONE43:
b = Batch(items,
size=pagesize,
start=pagenumber * pagesize)
else:
b = Batch(items,
pagesize=pagesize,
pagenumber=pagenumber)