From: Tony Mack Date: Fri, 10 Oct 2008 17:50:44 +0000 (+0000) Subject: bug fix in Table.sync. Only attempt to fetch/generate next primary key if it isnt... X-Git-Tag: PLCAPI-4.3-2~22 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=1da5ba9fb529bdae3adb90413347526d1b0c45ce;hp=f33f00dd690e8bcd8df9c6a542c35844a6a9aa8a;p=plcapi.git bug fix in Table.sync. Only attempt to fetch/generate next primary key if it isnt included --- diff --git a/PLC/Table.py b/PLC/Table.py index 74da3e9..07c3c09 100644 --- a/PLC/Table.py +++ b/PLC/Table.py @@ -231,8 +231,9 @@ class Row(dict): keys == [self.primary_key] or \ insert is True: - # If primary key id is a serial int, get next id - if self.fields[self.primary_key].type in (IntType, LongType): + # If primary key id is a serial int and it isnt included, get next id + if self.fields[self.primary_key].type in (IntType, LongType) and \ + self.primary_key not in self: pk_id = self.api.db.next_id(self.table_name, self.primary_key) self[self.primary_key] = pk_id db_fields[self.primary_key] = pk_id