From e0a2c2cf5745f8a42d34a82f0579440ae82a8fae Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Tue, 5 Jun 2018 04:08:53 +0200 Subject: [PATCH] Fixes for thread safe in models --- paramecio/cromosoma/querybuilder.py | 5 ++++- paramecio/cromosoma/webmodel.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/paramecio/cromosoma/querybuilder.py b/paramecio/cromosoma/querybuilder.py index 87ceab0..bde9c3c 100644 --- a/paramecio/cromosoma/querybuilder.py +++ b/paramecio/cromosoma/querybuilder.py @@ -25,7 +25,10 @@ def insert(model, dict_values, external_agent=True): query_error=False last_sql='' - model.fields[model.name_field_id].required=False + #model.fields[model.name_field_id].required=False + + if model.name_field_id in dict_values: + del dict_values[model.name_field_id] try: diff --git a/paramecio/cromosoma/webmodel.py b/paramecio/cromosoma/webmodel.py index 5d851eb..19e7c57 100644 --- a/paramecio/cromosoma/webmodel.py +++ b/paramecio/cromosoma/webmodel.py @@ -272,10 +272,14 @@ class WebModel: self.name_field_id=name_field_id - #Fields of the table, inserte with register method + #Fields of the table, inserted with register method self.fields=OrderedDict() + # Errors of fields of the table, for safe thread reasons. + + self.fields_error=OrderedDict() + #The tables related with foreignkeyfield to this table self.related=[]