[entropy.db.sql] rewrite type checking in insertDependencies()

metadata could be of list type (and not just tuple) in case of
data coming from websrv.
This commit is contained in:
Fabio Erculiani
2013-12-11 22:42:14 +01:00
parent eada088f56
commit 0243ed70b1

View File

@@ -18,7 +18,8 @@ import threading
from entropy.const import etpConst, const_debug_write, \
const_debug_enabled, const_isunicode, const_convert_to_unicode, \
const_get_buffer, const_convert_to_rawstring, const_is_python3
const_get_buffer, const_convert_to_rawstring, const_is_python3, \
const_get_stringtype
from entropy.exceptions import SystemDatabaseError, SPMError
from entropy.spm.plugins.factory import get_default_instance as get_spm
from entropy.output import bold, red
@@ -1684,12 +1685,14 @@ class EntropySQLRepository(EntropyRepositoryBase):
def insert_list():
deps = []
for dep in depdata:
deptype = 0
if isinstance(dep, tuple):
dep, deptype = dep
elif isinstance(depdata, dict):
if isinstance(depdata, dict):
deptype = depdata[dep]
elif not isinstance(dep, const_get_stringtype()):
dep, deptype = dep
iddep = self._isDependencyAvailable(dep)
if iddep == -1: