mailr15195 - /branches/spec_api/specific_fns/api_objects.py


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

Header


Content

Posted by edward on January 19, 2012 - 13:29:
Author: bugman
Date: Thu Jan 19 13:29:47 2012
New Revision: 15195

URL: http://svn.gna.org/viewcvs/relax?rev=15195&view=rev
Log:
Fix for the function checking in the specific API Param_list objects.

Class methods were not being detected!


Modified:
    branches/spec_api/specific_fns/api_objects.py

Modified: branches/spec_api/specific_fns/api_objects.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/spec_api/specific_fns/api_objects.py?rev=15195&r1=15194&r2=15195&view=diff
==============================================================================
--- branches/spec_api/specific_fns/api_objects.py (original)
+++ branches/spec_api/specific_fns/api_objects.py Thu Jan 19 13:29:47 2012
@@ -24,7 +24,7 @@
 """A module of special objects used within the specific function API."""
 
 # Python module imports.
-from types import FunctionType
+from types import FunctionType, MethodType
 
 # relax module imports.
 from relax_errors import RelaxError
@@ -108,19 +108,19 @@
         @param name:    The name of the parameter.
         @type name:     str
         @return:        The conversion factor.
-        @rtype:         None or float
+        @rtype:         float
         """
 
         # Check.
         if name not in self._names:
-            return None
+            return 1.0
 
         # No factor.
         if self._conv_factor[name] == None:
-            return None
+            return 1.0
 
         # Function.
-        if isinstance(self._conv_factor[name], FunctionType):
+        if isinstance(self._conv_factor[name], FunctionType) or 
isinstance(self._conv_factor[name], MethodType):
             return self._conv_factor[name]()
 
         # Value.
@@ -175,7 +175,7 @@
             raise RelaxError("The parameter '%s' does not exist." % name)
 
         # Function.
-        if isinstance(self._units[name], FunctionType):
+        if isinstance(self._conv_factor[name], FunctionType) or 
isinstance(self._conv_factor[name], MethodType):
             return self._units[name]()
 
         # Return the value.




Related Messages


Powered by MHonArc, Updated Thu Jan 19 14:00:02 2012