Files
tryton/trytond/tools/__init__.py
T
2016-03-03 21:51:57 +01:00

23 lines
645 B
Python

# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from itertools import izip
from .misc import *
from .datetime_strftime import *
from .decimal_ import *
class ClassProperty(property):
def __get__(self, cls, owner):
return self.fget.__get__(None, owner)()
def cursor_dict(cursor, size=None):
size = cursor.arraysize if size is None else size
while True:
rows = cursor.fetchmany(size)
if not rows:
break
for row in rows:
yield {d[0]: v for d, v in izip(cursor.description, row)}