wsme/wsmeext/extdirect/sadatastore.py
Ryan Petrello f91767bf1e pep8 fixes, including a declaration in tox.ini for running flake8
Change-Id: I2adc6a5cbd76edd16e6079046b67b8fc10bf1671
2013-09-05 11:15:27 -04:00

20 lines
596 B
Python

from wsmeext.extdirect import datastore
class SADataStoreController(datastore.DataStoreController):
__dbsession__ = None
__datatype__ = None
def read(self, query=None, sort=None, page=None, start=None, limit=None):
q = self.__dbsession__.query(self.__datatype__.__saclass__)
total = q.count()
if start is not None and limit is not None:
q = q.slice(start, limit)
return self.__readresulttype__(
data=[
self.__datatype__(o) for o in q
],
success=True,
total=total
)