Skip to content
Permalink
Browse files

db_manager: replace toPyObject() (old sip api; fixes #9991)

  • Loading branch information
jef-n committed Jun 1, 2014
1 parent dcc9d39 commit 272ac2ec55361810a7b8c769df6f9907a024224c
Showing with 6 additions and 5 deletions.
  1. +6 −5 python/plugins/db_manager/db_plugins/data_model.py
@@ -266,8 +266,9 @@ def _getNewObject(self):
return TableConstraint(None)

def getObject(self, row):
val = self.data(self.index(row, 0), Qt.UserRole)
constr = val.toPyObject() if val.isValid() else self._getNewObject()
constr = self.data(self.index(row, 0), Qt.UserRole)
if not constr:
constr = self._getNewObject()
constr.name = self.data(self.index(row, 0)) or ""
constr.type = self.data(self.index(row, 1), Qt.UserRole)
constr.columns = self.data(self.index(row, 2), Qt.UserRole)
@@ -297,8 +298,9 @@ def _getNewObject(self):
return TableIndex(None)

def getObject(self, row):
val = self.data(self.index(row, 0), Qt.UserRole)
idx = val.toPyObject() if val.isValid() else self._getNewObject()
idx = self.data(self.index(row, 0), Qt.UserRole)
if not idx:
idx = self._getNewObject()
idx.name = self.data(self.index(row, 0))
idx.columns = self.data(self.index(row, 1), Qt.UserRole)
return idx
@@ -308,4 +310,3 @@ def getIndexes(self):
for idx in self.getObjectIter():
idxs.append( idx )
return idxs

0 comments on commit 272ac2e

Please sign in to comment.
You can’t perform that action at this time.