aparo/pyes — pull request #111 by alambert (2011-10-13 20:07:31+00:00)
Title: Slicing a ResultSet causes TypeError: 'int' object is not callable

ResultSet.total is an int property, but slicing a ResultSet tries to call it.

Fixes this issue:

In [8]: c.search(pyes.query.MatchAllQuery())[1:]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/private/tmp/pyes/ in ()
----> 1 c.search(pyes.query.MatchAllQuery())[1:]

/private/tmp/pyes/pyes/es.py in __getitem__(self, val)
1386 return val, val + 1
1387
-> 1388 start, end = get_start_end(val)
1389 model = self.connection.model
1390

/private/tmp/pyes/pyes/es.py in get_start_end(val)
1380 else:
1381 start -= 1
-> 1382 end = val.stop or self.total()
1383 if end < 0:
1384 end = self.total() + end

TypeError: 'int' object is not callable

In [9]: