Skip to content

Commit

Permalink
Fix an indexing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Kritikos committed Feb 25, 2012
1 parent ae11416 commit 5e03d9e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cursors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ class PostgresqlCursor(NamedTupleCursor, collections.Sequence):

def __getitem__(self, index):
try:
self.scroll(index.start or 0, mode='absolute')
return self.fetchmany(index.stop - index.start)[::index.step]
start = index.start or 0
self.scroll(start, mode='absolute')
return self.fetchmany(index.stop - start)[::index.step]
except AttributeError:
self.scroll(index, mode='absolute')
return self.fetchone()
Expand Down

0 comments on commit 5e03d9e

Please sign in to comment.