mailr23329 - /trunk/lib/structure/internal/object.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on May 22, 2014 - 14:37:
Author: bugman
Date: Thu May 22 14:37:09 2014
New Revision: 23329

URL: http://svn.gna.org/viewcvs/relax?rev=23329&view=rev
Log:
Fix for bug #22069 by only deleting helix and sheet data with 
structure.delete when it exists.

This is bug #22069 (https://gna.org/bugs/index.php?22069), the failure of the 
structure.delete user
function with "AttributeError: Internal instance has no attribute 'helices'".


Modified:
    trunk/lib/structure/internal/object.py

Modified: trunk/lib/structure/internal/object.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/structure/internal/object.py?rev=23329&r1=23328&r2=23329&view=diff
==============================================================================
--- trunk/lib/structure/internal/object.py      (original)
+++ trunk/lib/structure/internal/object.py      Thu May 22 14:37:09 2014
@@ -1579,42 +1579,44 @@
             del_res_nums.reverse()
 
             # Handle the helix metadata.
-            del_helix_indices = []
-            for i in range(len(self.helices)):
-                # Trim the helix.
-                helix = self._trim_helix(helix=self.helices[i], 
trim_res_list=del_res_nums, res_data=res_data)
-
-                # Trimmed helix.
-                if helix != None:
-                    self.helices[i] = helix
-
-                # No helix left.
-                else:
-                    del_helix_indices.append(i)
-
-            # Loop over the reverse helix indices and pop out the data.
-            del_helix_indices.reverse()
-            for i in del_helix_indices:
-                self.helices.pop(i)
+            if hasattr(self, 'helices'):
+                del_helix_indices = []
+                for i in range(len(self.helices)):
+                    # Trim the helix.
+                    helix = self._trim_helix(helix=self.helices[i], 
trim_res_list=del_res_nums, res_data=res_data)
+
+                    # Trimmed helix.
+                    if helix != None:
+                        self.helices[i] = helix
+
+                    # No helix left.
+                    else:
+                        del_helix_indices.append(i)
+
+                # Loop over the reverse helix indices and pop out the data.
+                del_helix_indices.reverse()
+                for i in del_helix_indices:
+                    self.helices.pop(i)
 
             # Handle the sheet metadata.
-            del_sheet_indices = []
-            for i in range(len(self.sheets)):
-                # Trim the sheet.
-                sheet = self._trim_sheet(sheet=self.sheets[i], 
trim_res_list=del_res_nums, res_data=res_data)
-
-                # Trimmed sheet.
-                if sheet != None:
-                    self.sheets[i] = sheet
-
-                # No sheet left.
-                else:
-                    del_sheet_indices.append(i)
-
-            # Loop over the reverse sheet indices and pop out the data.
-            del_sheet_indices.reverse()
-            for i in del_sheet_indices:
-                self.sheets.pop(i)
+            if hasattr(self, 'sheets'):
+                del_sheet_indices = []
+                for i in range(len(self.sheets)):
+                    # Trim the sheet.
+                    sheet = self._trim_sheet(sheet=self.sheets[i], 
trim_res_list=del_res_nums, res_data=res_data)
+
+                    # Trimmed sheet.
+                    if sheet != None:
+                        self.sheets[i] = sheet
+
+                    # No sheet left.
+                    else:
+                        del_sheet_indices.append(i)
+
+                # Loop over the reverse sheet indices and pop out the data.
+                del_sheet_indices.reverse()
+                for i in del_sheet_indices:
+                    self.sheets.pop(i)
 
 
     def empty(self):




Related Messages


Powered by MHonArc, Updated Thu May 22 15:00:03 2014