From 0243ed70b14b73a34a47ed4bc5e468a596a54d4c Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Wed, 11 Dec 2013 22:42:14 +0100 Subject: [PATCH] [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. --- lib/entropy/db/sql.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/entropy/db/sql.py b/lib/entropy/db/sql.py index 78ddd8e05..b6eacf27b 100644 --- a/lib/entropy/db/sql.py +++ b/lib/entropy/db/sql.py @@ -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: