class Contact DictMixin def __init__ self name parent const modelRootN

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class Contact(DictMixin):
def __init__ (self, name,parent=const.modelRootNode, avatar=None):
...
self.children=[]
self.parent=parent
if self.parent != const.modelRootNode :
self.parent.children.sort(lambda x,y: cmp(x["name"],y["name"]))
def getParent(self):
return self.parent
...
contacts.append( Contact(name="User 1",parent=notInListGr,avatar="resources/av1.png" ) )
получаю на выходе
~/crabim> python main.py
PyQt4.QtCore.QPoint(1279, 992)
Traceback (most recent call last):
File "main.py", line 91, in <module>
main()
File "main.py", line 69, in main
contacts = ContactDB() #in future: c contactDB(settings.getContactDBfilename())
File "/home/fermer/crabim/modules/contacts.py", line 26, in __init__
self.contacts.append( Contact(name="User 1",parent=notInListGr,avatar="resources/av1.png" ) )
File "/home/fermer/crabim/modules/contacts.py", line 61, in __init__
if self.parent != const.modelRootNode :
File "/usr/lib64/python2.6/UserDict.py", line 177, in __cmp__
return cmp(dict(self.iteritems()), other)
File "/usr/lib64/python2.6/UserDict.py", line 109, in iteritems
for k in self:
File "/usr/lib64/python2.6/UserDict.py", line 96, in __iter__
for k in self.keys():
TypeError: keys() takes no arguments (1 given)