EduploneExam/userresponses SimpleResponse.py,1.22,1.22.2.1 __init__.py,1.2,1.2.2.1 SessionResponse.py,1.7,NONE

Nils Haagen <[email protected]> Sun, 02 Oct 2005 21:21:15 +0000
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-serv3645/userresponses

Modified Files:
      Tag: exam-1_1
	SimpleResponse.py __init__.py 
Removed Files:
      Tag: exam-1_1
	SessionResponse.py 
Log Message:
exam-1_1 init. moving to the next version...

Index: SimpleResponse.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/userresponses/SimpleResponse.py,v
retrieving revision 1.22
retrieving revision 1.22.2.1
diff -C2 -d -r1.22 -r1.22.2.1
*** SimpleResponse.py	8 Apr 2005 09:18:15 -0000	1.22
--- SimpleResponse.py	2 Oct 2005 21:21:13 -0000	1.22.2.1
***************
*** 1,11 ****
  # File: SimpleResponse.py
! """\
! unknown
! 
! """
  # Copyright (c) 2005 by eduplone Open Source Business Network EEIG, contributed
  # by FH-Aargau, Switzerland
! #
! # Generator: ArchGenXML Version 1.4 devel 1 http://sf.net/projects/archetypes/
  #
  # GNU General Public Licence (GPL)
--- 1,8 ----
  # File: SimpleResponse.py
! # 
  # Copyright (c) 2005 by eduplone Open Source Business Network EEIG, contributed
  # by FH-Aargau, Switzerland
! # Generator: ArchGenXML Version 1.4.0-beta2 devel 
! #            http://plone.org/products/archgenxml
  #
  # GNU General Public Licence (GPL)
***************
*** 26,55 ****
  __docformat__ = 'plaintext'
  
- from AccessControl import ClassSecurityInfo
- from Products.Archetypes.public import *
- 
  
  from Products.EduploneExam.interfaces.IExamResponse import IExamResponse
  
  
  from Products.EduploneExam.config import *
- 
  ##code-section module-header #fill in your manual code here
  ##/code-section module-header
  
! schema= Schema((
      FloatField('userScore',
          widget=DecimalWidget(
              label='Userscore',
              label_msgid='EduploneExam_label_userScore',
-             description='Enter a value for userScore.',
              description_msgid='EduploneExam_help_userScore',
              i18n_domain='EduploneExam',
!         ),
      ),
!     
  ),
  )
  
  ##code-section after-schema #fill in your manual code here
  ##/code-section after-schema
--- 23,62 ----
  __docformat__ = 'plaintext'
  
  
+ from AccessControl import ClassSecurityInfo
+ from Products.Archetypes.atapi import *
  from Products.EduploneExam.interfaces.IExamResponse import IExamResponse
  
  
  from Products.EduploneExam.config import *
  ##code-section module-header #fill in your manual code here
+ 
+ from Globals import InitializeClass
+ from Products.CMFCore.utils import getToolByName
+ from Products.Archetypes.config import UID_CATALOG
+ from ExtensionClass import Base
+ 
  ##/code-section module-header
  
! schema=Schema((
      FloatField('userScore',
          widget=DecimalWidget(
              label='Userscore',
              label_msgid='EduploneExam_label_userScore',
              description_msgid='EduploneExam_help_userScore',
              i18n_domain='EduploneExam',
!         )
      ),
! 
  ),
  )
  
+ 
+ ##code-section after-local-schema #fill in your manual code here
+ ##/code-section after-local-schema
+ 
+ SimpleResponse_schema = BaseSchema + \
+     schema
+ 
  ##code-section after-schema #fill in your manual code here
  ##/code-section after-schema
***************
*** 62,69 ****
      # This name appears in the 'add' box
      archetype_name             = 'SimpleResponse'
-     portal_type = meta_type    = 'SimpleResponse' 
  
!     allowed_content_types      = [] 
!     filter_content_types       = 1
      global_allow               = 1
      allow_discussion           = 0
--- 69,77 ----
      # This name appears in the 'add' box
      archetype_name             = 'SimpleResponse'
  
!     meta_type                  = 'SimpleResponse'
!     portal_type                = 'SimpleResponse'
!     allowed_content_types      = []
!     filter_content_types       = 0
      global_allow               = 1
      allow_discussion           = 0
***************
*** 71,90 ****
      immediate_view             = 'base_view'
      default_view               = 'base_view'
      typeDescription            = "SimpleResponse"
      typeDescMsgId              = 'description_edit_simpleresponse'
  
!     schema = BaseSchema + \
!              schema
  
      ##code-section class-header #fill in your manual code here
  
      _questionTitle=''
      _questionType=''
      _questionMaxScore=0
      _responseValues={}
! 
!     QUESTION_RELATION='response_to_question'
!     CONTEXT_RELATION='response_to_context'
! 
      ##/code-section class-header
  
--- 79,100 ----
      immediate_view             = 'base_view'
      default_view               = 'base_view'
+     suppl_views                = ()
      typeDescription            = "SimpleResponse"
      typeDescMsgId              = 'description_edit_simpleresponse'
  
!     schema = SimpleResponse_schema
  
      ##code-section class-header #fill in your manual code here
+     security = ClassSecurityInfo()
+     security.declareObjectPublic()
+     security.setDefaultAccess("allow")
  
      _questionTitle=''
      _questionType=''
      _questionMaxScore=0
+     _questionuid=None
+     _contextuid=None
      _responseValues={}
!     _userScore=0
      ##/code-section class-header
  
***************
*** 98,104 ****
          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
--- 108,112 ----
          sets the question as a reference and buffers some important values
          '''
!         self._questionuid = question.UID()
          self._questionTitle=question.Title()
          self._questionType=question.archetype_name
***************
*** 106,109 ****
--- 114,118 ----
  
  
+ 
      security.declarePublic('getQuestion')
      def getQuestion(self, instance):
***************
*** 111,119 ****
          returns the referenced question object
          '''
!         refs = self.getRefs(self.QUESTION_RELATION)
!         if refs:
!             return refs[0]
!         else:
!             return None
  
  
--- 120,125 ----
          returns the referenced question object
          '''
!         return self._lookupUID(self._questionuid, instance)
! 
  
  
***************
*** 126,129 ****
--- 132,136 ----
  
  
+ 
      security.declarePublic('getQuestionType')
      def getQuestionType(self):
***************
*** 134,156 ****
  
  
      security.declarePublic('setContext')
!     def setContext(self,contextobject):
          '''
          set context as a reference
          '''
!         self.deleteReferences(self.CONTEXT_RELATION)
!         self.addReference(contextobject, self.CONTEXT_RELATION)
  
  
      security.declarePublic('getContext')
!     def getContext(self,instance):
          '''
          returns the context object
          '''
!         refs = self.getRefs(self.CONTEXT_RELATION)
!         if refs:
!             return refs[0]
!         else:
!             return None
  
  
--- 141,161 ----
  
  
+ 
      security.declarePublic('setContext')
!     def setContext(self,context):
          '''
          set context as a reference
          '''
!         self._contextuid = context.UID()
! 
  
  
      security.declarePublic('getContext')
!     def getContext(self, instance):
          '''
          returns the context object
          '''
!         return self._lookupUID(self._contextuid, instance)
! 
  
  
***************
*** 160,164 ****
          sets the user score
          '''
!         self.setUserScore(score)
  
  
--- 165,170 ----
          sets the user score
          '''
!         self._userScore=score
! 
  
  
***************
*** 168,172 ****
          returns the user score
          '''
!         return self.getUserScore()
  
  
--- 174,179 ----
          returns the user score
          '''
!         return self._userScore
! 
  
  
***************
*** 179,182 ****
--- 186,190 ----
  
  
+ 
      security.declarePublic('getResponseValues')
      def getResponseValues(self):
***************
*** 188,191 ****
--- 196,200 ----
  
  
+ 
      security.declarePublic('setResponseValues')
      def setResponseValues(self, **kwargs):
***************
*** 197,200 ****
--- 206,210 ----
  
  
+ 
      security.declarePublic('__getitem__')
      def __getitem__(self, key):
***************
*** 205,209 ****
              return self._responseValues[key]
          else:
!             None
  
  
--- 215,233 ----
              return self._responseValues[key]
          else:
!             return None
! 
! 
!     #manually created methods
! 
!     def _lookupUID(self, uid, instance):
!         tool = getToolByName(instance, UID_CATALOG)
!         brains = tool(UID=uid)
!         for brain in brains:
!             obj = brain.getObject()
!             if obj is not None:
!                 return obj
!         else:
!             return None
! 
  
  

--- SessionResponse.py DELETED ---

Index: __init__.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/userresponses/__init__.py,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** __init__.py	8 Apr 2005 09:18:15 -0000	1.2
--- __init__.py	2 Oct 2005 21:21:13 -0000	1.2.2.1
***************
*** 4,8 ****
  ##code-section init-module-header #fill in your manual code here
  ##/code-section init-module-header
!  
  
  #subpackages
--- 4,8 ----
  ##code-section init-module-header #fill in your manual code here
  ##/code-section init-module-header
! 
  
  #subpackages
***************
*** 13,14 ****
--- 13,15 ----
  ##code-section init-module-footer #fill in your manual code here
  ##/code-section init-module-footer
+ 



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