source: WAeUP_SRP/base/skins/waeup_student/getLevelSession.py @ 2725

Last change on this file since 2725 was 2470, checked in by joachim, 17 years ago

open level for edit (in custom)

  • Property svn:keywords set to Id
File size: 976 bytes
Line 
1## Script (Python) "getLevelSession"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=level_doc,student_id,level_id
8##title=
9##
10# $Id: getLevelSession.py 2470 2007-10-29 09:05:08Z joachim $
11"""
12return fixed session_id from level
13"""
14try:
15    from Products.zdb import set_trace
16except:
17    def set_trace():
18        pass
19import logging
20logger = logging.getLogger('Skins.getLevelSession')
21session_id = level_doc.session
22changed = False
23if len(session_id) == 2:
24    pass
25elif len(session_id) == 9:
26    changed = True
27    session_id = session_id[2:4]
28if len(session_id) != 2:
29    logger.info("invalid session %s in level %s for student %s" %
30                (session_id,level_id,student_id))
31else:
32    if changed:
33        context.portal_workflow.doActionFor(level_doc.aq_parent,'open')
34        level_doc.edit(mapping={'session': session_id})
35        context.portal_workflow.doActionFor(level_doc.aq_parent,'close_for_edit')
36return session_id
37
38   
39
Note: See TracBrowser for help on using the repository browser.