make sure composite_primary_key==[] is interpreted as not existing
diff --git a/xos/core/models/plcorebase.py b/xos/core/models/plcorebase.py
index 238e6f0..a5f73e5 100644
--- a/xos/core/models/plcorebase.py
+++ b/xos/core/models/plcorebase.py
@@ -192,12 +192,12 @@
def check_composite_primary_key(self):
try:
- composite_key_exists = self.composite_primary_key
+ composite_key_exists = (self.composite_primary_key!=None) and (self.composite_primary_key!=[])
except AttributeError:
composite_key_exists = False
- if (not composite_key_exists):
- return
+ if (not composite_key_exists):
+ return
# dictionary containing cpk field name and value
cpk_fields = dict([(name, getattr(self, name)) for name in self.composite_primary_key])