Author: bugman Date: Mon May 7 10:31:18 2012 New Revision: 16030 URL: http://svn.gna.org/viewcvs/relax?rev=16030&view=rev Log: The user function data object add_class() and add_uf() methods now check for uniqueness. This is to catch coding errors whereby the user function class or name has been duplicated. Modified: branches/uf_redesign/user_functions/data.py Modified: branches/uf_redesign/user_functions/data.py URL: http://svn.gna.org/viewcvs/relax/branches/uf_redesign/user_functions/data.py?rev=16030&r1=16029&r2=16030&view=diff ============================================================================== --- branches/uf_redesign/user_functions/data.py (original) +++ branches/uf_redesign/user_functions/data.py Mon May 7 10:31:18 2012 @@ -66,6 +66,10 @@ @rtype: user_functions.objects.Class_container instance """ + # Check if the user function already exists. + if name in self._class_names: + raise RelaxError("The user function class %s has already been set up." % name) + # Store the name and initialise a new object. self._class_names.append(name) self._classes.append(Class_container()) @@ -82,6 +86,10 @@ @return: The user function data object. @rtype: user_functions.objects.Uf_container instance """ + + # Check if the user function already exists. + if name in self._uf_names: + raise RelaxError("The user function %s has already been set up." % name) # First check if the user function class has been set up. if search('.', name):