EduploneExam/userresponses SimpleResponse.py,1.11,1.12
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-serv28488/userresponses
Modified Files:
SimpleResponse.py
Log Message:
rebuild and SimpleResponse works now
Index: SimpleResponse.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/userresponses/SimpleResponse.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** SimpleResponse.py 15 Dec 2004 12:25:02 -0000 1.11
--- SimpleResponse.py 15 Dec 2004 13:56:04 -0000 1.12
***************
*** 8,16 ****
# by FH-Aargau, Switzerland
#
! # Generated: Wed Dec 15 13:13:25 2004
# Generator: ArchGenXML Version 1.2 devel 3 http://sf.net/projects/archetypes/
#
# 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
--- 8,16 ----
# by FH-Aargau, Switzerland
#
! # Generated: Wed Dec 15 14:24:36 2004
# Generator: ArchGenXML Version 1.2 devel 3 http://sf.net/projects/archetypes/
#
# 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,45 ****
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,)
--- 39,45 ----
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,)
***************
*** 50,53 ****
--- 50,54 ----
_questionType=''
_questionMaxScore=0
+ _responseValues={}
QUESTION_RELATION='response_to_question'
***************
*** 65,69 ****
),
),
!
StringField('title',
accessor='''Title''',
--- 66,70 ----
),
),
!
StringField('title',
accessor='''Title''',
***************
*** 76,80 ****
),
),
!
FloatField('userScore',
widget=DecimalWidget(description='Enter a value for userScore.',
--- 77,81 ----
),
),
!
FloatField('userScore',
widget=DecimalWidget(description='Enter a value for userScore.',
***************
*** 85,89 ****
),
),
!
),
)
--- 86,90 ----
),
),
!
),
)
***************
*** 148,167 ****
- def setResponseValues(self, **kwargs):
- '''
-
- '''
-
- pass
-
-
- def getResponseValues(self):
- '''
-
- '''
-
- pass
-
-
def setScore(self, score):
'''
--- 149,152 ----
***************
*** 185,188 ****
--- 170,200 ----
+ def getResponseValues(self):
+ '''
+ returns a dictionary where key is the AnswerUID and value is whats a
+ user said.
+ '''
+ return self._responseValues
+
+
+ def setResponseValues(self, **kwargs):
+ '''
+ kwargs is a dictionary where key is AnswerUID and value is what a
+ user said.
+ '''
+ self._responseValues=kwargs
+
+
+ def __getitem__(self, key):
+ '''
+ returns a specific response value
+ '''
+ if self._responseValues.has_key(key):
+ return self._responseValues[key]
+ else:
+ raise KeyError("Invalid key '%s' for class %s with UID %s." % \
+ (key, self.__name__, self.UID()))
+
+
# uncomment lines below when you need
***************
*** 196,205 ****
}
!
actions= (
!
)
!
registerType(SimpleResponse)
--- 208,217 ----
}
!
actions= (
!
)
!
registerType(SimpleResponse)
***************
*** 208,211 ****
##code-section module-footer #fill in your manual code here
##/code-section module-footer
-
-
--- 220,221 ----
-------------------------------------------------------
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/