EduploneExam/userresponses SimpleResponse.py,1.4,1.5

Jens Klein <[email protected]>
Newsgroups gmane.comp.web.zope.eduplone.cvs
Message-ID <[email protected]>
Update of /cvsroot/eduplone/EduploneExam/userresponses
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27907/userresponses

Modified Files:
	SimpleResponse.py 
Log Message:
fixed code and tests


Index: SimpleResponse.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/userresponses/SimpleResponse.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SimpleResponse.py	15 Dec 2004 10:53:54 -0000	1.4
--- SimpleResponse.py	15 Dec 2004 11:22:38 -0000	1.5
***************
*** 12,16 ****
  #
  # GNU General Public Licence (GPL)
! # 
  # This program is free software; you can redistribute it and/or modify it under
  # the terms of the GNU General Public License as published by the Free Software
--- 12,16 ----
  #
  # GNU General Public Licence (GPL)
! #
  # This program is free software; you can redistribute it and/or modify it under
  # the terms of the GNU General Public License as published by the Free Software
***************
*** 39,55 ****
  class SimpleResponse(BaseContent):
      security = ClassSecurityInfo()
!     portal_type = meta_type = 'SimpleResponse' 
!     archetype_name = 'SimpleResponse'   #this name appears in the 'add' box 
!     allowed_content_types = [] 
  
      __implements__ = getattr(BaseContent,'__implements__',()) + (IExamResponse,)
  
      ##code-section class-header #fill in your manual code here
!     
!     _questionUID=None
      _questionTitle=''
      _questionType=''
      _questionMaxScore=0
!     
      ##/code-section class-header
  
--- 39,55 ----
  class SimpleResponse(BaseContent):
      security = ClassSecurityInfo()
!     portal_type = meta_type = 'SimpleResponse'
!     archetype_name = 'SimpleResponse'   #this name appears in the 'add' box
!     allowed_content_types = []
  
      __implements__ = getattr(BaseContent,'__implements__',()) + (IExamResponse,)
  
      ##code-section class-header #fill in your manual code here
! 
      _questionTitle=''
      _questionType=''
      _questionMaxScore=0
! 
!     QUESTION_RELATION='response_to_question'
      ##/code-section class-header
  
***************
*** 63,67 ****
              ),
          ),
!         
          StringField('title',
              accessor='''Title''',
--- 63,67 ----
              ),
          ),
! 
          StringField('title',
              accessor='''Title''',
***************
*** 74,78 ****
              ),
          ),
!         
          FloatField('userScore',
              widget=DecimalWidget(description='Enter a value for userScore.',
--- 74,78 ----
              ),
          ),
! 
          FloatField('userScore',
              widget=DecimalWidget(description='Enter a value for userScore.',
***************
*** 83,87 ****
              ),
          ),
!         
      ),
      )
--- 83,87 ----
              ),
          ),
! 
      ),
      )
***************
*** 92,99 ****
      def setQuestion(self, question):
          '''
!         
          '''
!         self._questionUID=question.UID()
!         self._questionTitle=question.getTitle()
          self._questionType=question.archetype_name
          self._questionMaxScore=question.getMaxScore()
--- 92,101 ----
      def setQuestion(self, question):
          '''
!         sets the question as a reference and buffers some important values
          '''
!         self.deleteReferences(self.QUESTION_RELATION)
!         self.addReference(question, self.QUESTION_RELATION)
! 
!         self._questionTitle=question.Title()
          self._questionType=question.archetype_name
          self._questionMaxScore=question.getMaxScore()
***************
*** 102,113 ****
      def getQuestion(self):
          '''
!         
          '''
!         return self._questionUID
  
  
      def getQuestionTitle(self):
          '''
!         
          '''
          return self._questionTitle
--- 104,119 ----
      def getQuestion(self):
          '''
!         returns the referenced question object
          '''
!         refs = self.getRefs(self.QUESTION_RELATION)
!         if refs:
!             return refs[0]
!         else:
!             return None
  
  
      def getQuestionTitle(self):
          '''
! 
          '''
          return self._questionTitle
***************
*** 116,120 ****
      def getQuestionType(self):
          '''
!         
          '''
          return self._questionType
--- 122,126 ----
      def getQuestionType(self):
          '''
! 
          '''
          return self._questionType
***************
*** 123,129 ****
      def setResponseValues(self, **kwargs):
          '''
!         
          '''
!         
          pass
  
--- 129,135 ----
      def setResponseValues(self, **kwargs):
          '''
! 
          '''
! 
          pass
  
***************
*** 131,137 ****
      def getResponseValues(self):
          '''
!         
          '''
!         
          pass
  
--- 137,143 ----
      def getResponseValues(self):
          '''
! 
          '''
! 
          pass
  
***************
*** 139,143 ****
      def setScore(self, score):
          '''
!         
          '''
          self.setUserScore(score)
--- 145,149 ----
      def setScore(self, score):
          '''
! 
          '''
          self.setUserScore(score)
***************
*** 146,150 ****
      def getScore(self):
          '''
!         
          '''
          self.getUserScore()
--- 152,156 ----
      def getScore(self):
          '''
! 
          '''
          self.getUserScore()
***************
*** 153,159 ****
      def getMaxScore(self):
          '''
!         
          '''
!         
          return self._questionMaxScore
  
--- 159,165 ----
      def getMaxScore(self):
          '''
! 
          '''
! 
          return self._questionMaxScore
  
***************
*** 170,179 ****
          }
  
!         
      actions=  (
!         
  
            )
!         
  
  registerType(SimpleResponse)
--- 176,185 ----
          }
  
! 
      actions=  (
! 
  
            )
! 
  
  registerType(SimpleResponse)
***************
*** 182,185 ****
  ##code-section module-footer #fill in your manual code here
  ##/code-section module-footer
- 
- 
--- 188,189 ----



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.