EduploneExam/answers SingleChoiceAnswer.py,1.23.2.1,1.23.2.2

"Fabian K." <[email protected]> Sun, 16 Oct 2005 16:57:11 +0000
Newsgroups gmane.comp.web.zope.eduplone.cvs
Message-ID <[email protected]>
Update of /cvsroot/eduplone/EduploneExam/answers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4161

Modified Files:
      Tag: exam-1_1
	SingleChoiceAnswer.py 
Log Message:
Made SingleChoice evaluated in strict mode by default

Index: SingleChoiceAnswer.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/answers/SingleChoiceAnswer.py,v
retrieving revision 1.23.2.1
retrieving revision 1.23.2.2
diff -C2 -d -r1.23.2.1 -r1.23.2.2
*** SingleChoiceAnswer.py	2 Oct 2005 21:21:12 -0000	1.23.2.1
--- SingleChoiceAnswer.py	16 Oct 2005 16:57:09 -0000	1.23.2.2
***************
*** 34,37 ****
--- 34,38 ----
  from Products.EduploneExam.config import *
  ##code-section module-header #fill in your manual code here
+ from types import StringTypes
  ##/code-section module-header
  
***************
*** 78,81 ****
--- 79,103 ----
  
      ##code-section class-header #fill in your manual code here
+     
+     security.declarePublic('processValue')
+     def processValue(self, value=None):
+     	"""
+     		Override function as strict mode is default by now
+     	"""
+     	if type(value) in StringTypes and value.lower() in ['0', 'false']:
+             value=False
+         if type(value) in StringTypes and value.lower() in ['on', 'true']:
+             value=True
+ 
+         if value:
+             value=True
+         else:
+             value=False    
+ 
+     	if self.getCorrect() == True and value == True:
+     		return True
+     	else:
+     		return False
+     
      ##/code-section class-header
  



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl