git://git.onelab.eu
/
plcapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f33f00d
)
bug fix in Table.sync. Only attempt to fetch/generate next primary key if it isnt...
author
Tony Mack
<tmack@cs.princeton.edu>
Fri, 10 Oct 2008 17:50:44 +0000
(17:50 +0000)
committer
Tony Mack
<tmack@cs.princeton.edu>
Fri, 10 Oct 2008 17:50:44 +0000
(17:50 +0000)
PLC/Table.py
patch
|
blob
|
history
diff --git
a/PLC/Table.py
b/PLC/Table.py
index
74da3e9
..
07c3c09
100644
(file)
--- a/
PLC/Table.py
+++ b/
PLC/Table.py
@@
-231,8
+231,9
@@
class Row(dict):
keys == [self.primary_key] or \
insert is True:
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
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