← Back to team overview

launchpad-dev team mailing list archive

Weird storm slicing behaviour

 

Hi all,

While having a look at:
https://bugs.launchpad.net/launchpad/+bug/872086 I found a weird storm
behaviour that I think is the root of the problem. I thought I'd share
this with the list before I go any deeper to see what you think ...

Basically, if res is a SQLObjectResultSet, then slicing it using
res[0:0] does not seem to slice it really.

./bin/harness
>>> from lp.registry.interfaces.distribution import IDistributionSet
>>> from lp.registry.interfaces.distroseries import IDistroSeriesSet
>>> ubuntu = getUtility(IDistributionSet).getByName("ubuntu")
>>> distroseriesset = getUtility(IDistroSeriesSet)

>>> list(distroseriesset.search(distribution=ubuntu))
[<DistroSeries u'warty'>, <DistroSeries u'hoary'>, <DistroSeries
u'grumpy'>, <DistroSeries u'breezy-autotest'>]
# Good
# SELECT DistroSeries.backports_not_automatic,[...] FROM DistroSeries
WHERE distribution = 1 ORDER BY DistroSeries.distribution,
DistroSeries.version

>>> list(distroseriesset.search(distribution=ubuntu)[1:1])
[]
# Good
# SELECT DistroSeries.backports_not_automatic,[...] FROM DistroSeries
WHERE distribution = 1 ORDER BY DistroSeries.distribution,
DistroSeries.version LIMIT 0 OFFSET 1

>>> list(distroseriesset.search(distribution=ubuntu)[0:0])
[<DistroSeries u'warty'>, <DistroSeries u'hoary'>, <DistroSeries
u'grumpy'>, <DistroSeries u'breezy-autotest'>]
# No limit nor offset in the generated query ... ?!
# SELECT DistroSeries.backports_not_automatic,[...] FROM DistroSeries
WHERE distribution = 1 ORDER BY DistroSeries.distribution,
DistroSeries.version


Follow ups