The schema created by Django+South only (that is, not using the schema SQL file) is a bit more strict, including having more NOT NULL fields.
But, the TKO parser database code inserts data into the database using a custom creator of INSERT statements that mentions every single field. Fields without data contains 'None' which get mapped into NULLs. To avoid breakage with the stricter schema, simply ommit fields that have no value (None). Eventually all this custom code will be removed and will hopefully use Django's database/ORM layer for all database access, so this kind of hack won't be needed. Signed-off-by: Cleber Rosa <[email protected]> --- tko/db.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tko/db.py b/tko/db.py index 41ff608..8057477 100644 --- a/tko/db.py +++ b/tko/db.py @@ -265,8 +265,9 @@ class db_sql(object): dictionary of fields and data """ fields = data.keys() - refs = ['%s' for field in fields] - values = [data[field] for field in fields] + fields = [f for f in fields if data[f] is not None] + refs = ['%s' for field in fields if data[field] is not None] + values = [data[field] for field in fields if data[field] is not None] cmd = ('insert into %s (%s) values (%s)' % (table, ','.join(self._quote(field) for field in fields), ','.join(refs))) -- 1.7.11.7 _______________________________________________ Autotest-kernel mailing list [email protected] https://www.redhat.com/mailman/listinfo/autotest-kernel
