Files
tryton/trytond/tools/__init__.py
T

22 lines
645 B
Python
Raw Normal View History

2014-12-02 12:54:01 +01:00
# 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
2011-12-14 17:00:13 +01:00
from .misc import *
from .datetime_strftime import *
2014-10-27 23:12:45 +01:00
from .decimal_ import *
2012-09-24 22:16:53 +02:00
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)}