diff --git a/xos/core/models/plcorebase.py b/xos/core/models/plcorebase.py
index 68c9c12..377bf19 100644
--- a/xos/core/models/plcorebase.py
+++ b/xos/core/models/plcorebase.py
@@ -30,7 +30,7 @@
         if value is not None:
             value = value.strip()
         return super(StrippedCharField, self).clean(value, *args, **kwds)
-            
+
 
 # This manager will be inherited by all subclasses because
 # the core model is abstract.
@@ -152,7 +152,7 @@
     write_protect = models.BooleanField(default=False)
 
     # XXX Django has no official support for composite primray keys yet
-    # so we will hack in an inefficient solution here.  
+    # so we will hack in an inefficient solution here.
     composite_primary_key = []
 
     class Meta:
@@ -186,34 +186,40 @@
             super(PlCoreBase, self).delete(*args, **kwds)
         else:
             if (not self.write_protect):
-                    self.deleted = True
-                    self.enacted=None
-                    self.save(update_fields=['enacted','deleted'], silent=silent)
+                self.deleted = True
+                self.enacted=None
+                self.save(update_fields=['enacted','deleted'], silent=silent)
 
     def check_composite_primary_key(self):
-        if not self.composite_primary_key:
-            return 
+        try:
+            composite_key_exists = self.composite_primary_key
+        except AttributeError:
+            composite_key_exists = False
+
+            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])
         objs = self.__class__.objects.filter(**cpk_fields)
-        # we can only continue if there are no matches or 
-        # if this record is updating itself         
+        # we can only continue if there are no matches or
+        # if this record is updating itself
         if (len(objs) == 0 or
             (len(objs) == 1 and self.id and objs[0].id == self.id)):
-            return 
-        # if we reach this point then we've matched more than 1 
-        # existing record or we are trying to  
+            return
+        # if we reach this point then we've matched more than 1
+        # existing record or we are trying to
         msg = "%s violates composite primray key constraint on fields: %s " % (self, self.composite_primary_key)
         raise db.Error, msg
-                 
-               
+
+
     def save(self, *args, **kwargs):
         # let the user specify silence as either a kwarg or an instance varible
         silent = self.silent
         if "silent" in kwargs:
             silent=silent or kwargs.pop("silent")
 
-        self.check_composite_primary_key()    
+        self.check_composite_primary_key()
 
         super(PlCoreBase, self).save(*args, **kwargs)
 
@@ -245,10 +251,4 @@
 
     @classmethod
     def is_ephemeral(cls):
-	return cls in ephemeral_models
-
-
-
-
-
-
+        return cls in ephemeral_models
