Есть функция
def get_zreport(idstore, zdate):
сonn = get_connect()
cursor = сonn.cursor()
qt = DBQ.ZReport(cursor, idstore, zdate)
qt.open()
qt.fetchall()
result = {'zreport' : []}
while(qt.read()):
shifts = result['zreport']
idx = len(shifts)
if idx == 0 or shifts[idx-1]['idshift'] != qt.idshift:
sh = {'idshift' : qt.idshift,
'iddevice' : qt.iddevice,
'zdate' : zdate,
'position' : [] }
shifts.append(sh)
position = {'idproduct' : qt.idproduct,
'quantity' : qt.quantity}
sh['position'].append(position)
qt.next()
сonn.close()
return result
Есть класс
class ZReport(Query):
def __init__(self, cursor, idstore, zdate):
sql = '''select s.idshift, cv.iddevice, s.open, s.close, c.idproduct, sum(c.ammount) as quantity from shift s
left join cashvoucher cv on cv.uuidsession = s.uuid and cv.idstore = s.uuidstore
inner join cost c on c.idcashvoucher = cv.idcashvoucher
where s.close::date = %(zdate)s::date
and s.uuidstore = %(idstore)s
group by s.idshift, cv.iddevice, c.idproduct
order by s.open'''
param = {'idstore' : idstore, 'zdate' : zdate }
super().__init__(cursor, sql, param)
self.idshift = -1
self.iddevice = ''
self.open = ''
self.close = ''
self.idproduct = -1
self.quantity = 0
получаю такую ошибку
File "C:\service\clientrequest.py", line 52, in get_zreport
qt.open()
TypeError: 'str' object is not callable
Другие наследники Query прекрасно работают в аналогичных условиях.
В чём причина, такого странного поведения?