[SQL-CVS] r4430 - in SQLObject/branches/1.1: docs sqlobject sqlobject/tests
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2011-07-18 20:36:03
|
Author: phd Date: Mon Jul 18 14:35:52 2011 New Revision: 4430 Log: Merged revision 4429 from branch 1.0: a bug was fixed in SelectResults slicing that prevented to slice a slice (my_results[:20][1:5]). Modified: SQLObject/branches/1.1/docs/News.txt SQLObject/branches/1.1/sqlobject/sresults.py SQLObject/branches/1.1/sqlobject/tests/test_slice.py Modified: SQLObject/branches/1.1/docs/News.txt ============================================================================== --- SQLObject/branches/1.1/docs/News.txt Mon Jul 18 14:32:40 2011 (r4429) +++ SQLObject/branches/1.1/docs/News.txt Mon Jul 18 14:35:52 2011 (r4430) @@ -45,6 +45,12 @@ * All 'mydict.has_key(name)' checks were replaced with 'name in mydict'. +SQLObject 1.0.2 +=============== + +* A bug was fixed in SelectResults slicing that prevented to slice a + slice (my_results[:20][1:5]). + SQLObject 1.0.1 =============== Modified: SQLObject/branches/1.1/sqlobject/sresults.py ============================================================================== --- SQLObject/branches/1.1/sqlobject/sresults.py Mon Jul 18 14:32:40 2011 (r4429) +++ SQLObject/branches/1.1/sqlobject/sresults.py Mon Jul 18 14:35:52 2011 (r4430) @@ -1,7 +1,9 @@ -import sqlbuilder import dbconnection -import main import joins +import main +import sqlbuilder + +__all__ = ['SelectResults'] class SelectResults(object): IterationClass = dbconnection.Iteration @@ -152,8 +154,8 @@ end = start else: end = value.stop + self.ops.get('start', 0) - if self.ops.get('end', None) is not None \ - and value['end'] < end: + if self.ops.get('end', None) is not None and \ + self.ops['end'] < end: # truncated by previous slice: end = self.ops['end'] else: @@ -342,5 +344,3 @@ clause = sqlbuilder.AND(otherClass.q.id == getattr(intTable, join.otherColumn), getattr(intTable, colName) == query.q.id) return otherClass, clause - -__all__ = ['SelectResults'] Modified: SQLObject/branches/1.1/sqlobject/tests/test_slice.py ============================================================================== --- SQLObject/branches/1.1/sqlobject/tests/test_slice.py Mon Jul 18 14:32:40 2011 (r4429) +++ SQLObject/branches/1.1/sqlobject/tests/test_slice.py Mon Jul 18 14:35:52 2011 (r4430) @@ -21,31 +21,30 @@ return assert [c.number for c in counters] == value - def test_1(self): + def test_slice(self): self.counterEqual( Counter.select(None, orderBy='number'), range(100)) - def test_2(self): self.counterEqual( Counter.select(None, orderBy='number')[10:20], range(10, 20)) - def test_3(self): self.counterEqual( Counter.select(None, orderBy='number')[20:30][:5], range(20, 25)) - def test_4(self): + self.counterEqual( + Counter.select(None, orderBy='number')[20:30][1:5], + range(21, 25)) + self.counterEqual( Counter.select(None, orderBy='number')[:-10], range(0, 90)) - def test_5(self): self.counterEqual( Counter.select(None, orderBy='number', reversed=True), range(99, -1, -1)) - def test_6(self): self.counterEqual( Counter.select(None, orderBy='-number'), range(99, -1, -1)) |