EduploneExam ExamFolder.py,1.31,1.32 registry.py,1.6,1.7

Nils Haagen <[email protected]> Mon, 19 Sep 2005 06:42:54 +0000
Newsgroups gmane.comp.web.zope.eduplone.cvs
Message-ID <[email protected]>
Update of /cvsroot/eduplone/EduploneExam
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2531

Modified Files:
	ExamFolder.py registry.py 
Log Message:
extended registry (allowedContentTypes) with additionalTypes;

Index: registry.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/registry.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** registry.py	14 Dec 2004 16:50:30 -0000	1.6
--- registry.py	19 Sep 2005 06:42:52 -0000	1.7
***************
*** 30,37 ****
--- 30,47 ----
  _question_types = {}
  _answer_types = {}
+ _additional_types = {}
  
  from interfaces.IExamQuestion import IExamQuestion
  from interfaces.IExamAnswer import IExamAnswer
  
+ def registerAdditionalType(klass):
+     """ register an additional class, such as QOrderProcessor """
+     if not klass.__name__ in _additional_types.keys():
+         _additional_types[klass.__name__]=klass
+         print _additional_types
+         
+ def getAdditionalTypes():
+     return _additional_types.copy()
+ 
  def registerQuestionType(klass):
      """ register a IExamQuestion implementing class """

Index: ExamFolder.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneExam/ExamFolder.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** ExamFolder.py	11 Sep 2005 09:48:42 -0000	1.31
--- ExamFolder.py	19 Sep 2005 06:42:52 -0000	1.32
***************
*** 36,40 ****
  ##code-section module-header #fill in your manual code here
  from Products.CMFCore.utils import getToolByName
! from registry import getQuestionTypes
  from Products.EduploneExam.userresponses.SessionResponse import SessionResponse
  
--- 36,40 ----
  ##code-section module-header #fill in your manual code here
  from Products.CMFCore.utils import getToolByName
! from registry import getQuestionTypes, getAdditionalTypes
  from Products.EduploneExam.userresponses.SessionResponse import SessionResponse
  
***************
*** 126,129 ****
--- 126,132 ----
  
      #Methods
+     def xx(self):
+         """ """
+         return str(getAdditionalTypes())
  
      def showEditableBorder(self, **kwargs):
***************
*** 132,138 ****
          pmt=getToolByName(self, 'portal_membership')
          return pmt.checkPermission("Modify Portal Content", self)
-         #getSecurityManager().getUser()
-         
-         return False
  
      security.declarePublic('allowedContentTypes')
--- 135,138 ----
***************
*** 145,148 ****
--- 145,153 ----
                       for key in qtypes]\
                    ]
+ 
+         atypes = getAdditionalTypes()                  
+         for key in atypes:
+             allowed.append(tt[atypes[key].meta_type])
+             
          return allowed
  
***************
*** 182,186 ****
--- 187,197 ----
          ti = tt[self.meta_type]
          qtypes = getQuestionTypes()
+         atypes = getAdditionalTypes()
+         print 'atypes:'
+         print atypes
          allowedmetatypes = [qtypes[key].meta_type for key in qtypes]
+         for key in atypes:
+             allowedmetatypes.append(atypes[key].meta_type)
+             
          ti.allowed_content_types=tuple(allowedmetatypes)
  



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php