mailr18728 - /trunk/specific_fns/api_common.py


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

Header


Content

Posted by edward on March 09, 2013 - 11:48:
Author: bugman
Date: Sat Mar  9 11:48:35 2013
New Revision: 18728

URL: http://svn.gna.org/viewcvs/relax?rev=18728&view=rev
Log:
All of the specific API data and error returning common methods can now 
handle missing data/errors.

This affects the _return_data_relax_data() and _return_value_general() 
methods.


Modified:
    trunk/specific_fns/api_common.py

Modified: trunk/specific_fns/api_common.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_fns/api_common.py?rev=18728&r1=18727&r2=18728&view=diff
==============================================================================
--- trunk/specific_fns/api_common.py (original)
+++ trunk/specific_fns/api_common.py Sat Mar  9 11:48:35 2013
@@ -236,7 +236,13 @@
         # Convert to a list.
         data = []
         for ri_id in cdp.ri_ids:
-            data.append(spin.ri_data[ri_id])
+            # Handle missing data.
+            if ri_id not in spin.ri_data:
+                data.append(None)
+
+            # Append the value.
+            else:
+                data.append(spin.ri_data[ri_id])
 
         # Return the list.
         return data
@@ -350,9 +356,18 @@
 
         # Dictionary object.
         if key:
-            value = value[key]
+            # Handle missing data.
+            if key not in value:
+                value = None
+            else:
+                value = value[key]
+
             if error:
-                error = error[key]
+                # Handle missing errors.
+                if key not in error:
+                    error = None
+                else:
+                    error = error[key]
 
         # Return the data.
         if sim == None:




Related Messages


Powered by MHonArc, Updated Sat Mar 09 12:00:02 2013