EduploneExam/questions BaseExamQuestion.py,1.30.2.8,1.30.2.9

"Fabian K." <[email protected]> Mon, 27 Feb 2006 21:57:40 +0000
Newsgroups gmane.comp.web.zope.eduplone.cvs
Message-ID <[email protected]>
Update of /cvsroot/eduplone/EduploneExam/questions
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17755/questions

Modified Files:
      Tag: exam-1_1
	BaseExamQuestion.py 
Log Message:
Added random answer output in exam view. Changed model and added one attribute to ExamFolder. Build 66.

Index: BaseExamQuestion.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/questions/BaseExamQuestion.py,v
retrieving revision 1.30.2.8
retrieving revision 1.30.2.9
diff -C2 -d -r1.30.2.8 -r1.30.2.9
*** BaseExamQuestion.py	26 Feb 2006 20:09:02 -0000	1.30.2.8
--- BaseExamQuestion.py	27 Feb 2006 21:57:38 -0000	1.30.2.9
***************
*** 37,40 ****
--- 37,41 ----
  from Products.CMFCore.utils import getToolByName
  from Products.Archetypes.config import UID_CATALOG
+ import random
  ##/code-section module-header
  
***************
*** 172,175 ****
--- 173,187 ----
      #manually created methods
  
+     def randomContentValues(self, randomize=True):
+         """ Randomize the order of the answers.
+             The randomize parameter is neccessary because TAL language
+             doesn't support multiple-line-statements. """
+         randomizedValues = self.contentValues()
+         if randomize in [True, False]:
+             if randomize:
+                 random.shuffle(randomizedValues)
+         return randomizedValues
+ 
+ 
      def _lookupUID(self, uid):
          tool = getToolByName(self, UID_CATALOG)
***************
*** 181,185 ****
          else:
              return None
! 
  
  # end of class BaseExamQuestion
--- 193,197 ----
          else:
              return None
!             
  
  # end of class BaseExamQuestion



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642