source: WAeUP_SRP/trunk/skins/waeup_student/getLevelSession.py @ 16586

Last change on this file since 16586 was 2752, checked in by Henrik Bettermann, 17 years ago

close_for_edit deprecated

Objects should always be opened unless the verdict has been imported.

We need a script which opens all levels before we import the verdicts.

  • Property svn:keywords set to Id
File size: 1021 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 2752 2007-11-24 06:06:14Z henrik $
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        try:
34            context.portal_workflow.doActionFor(level_doc.aq_parent,'open')
35        except:
36            pass
37        level_doc.edit(mapping={'session': session_id})
38        #context.portal_workflow.doActionFor(level_doc.aq_parent,'close_for_edit')
39return session_id
40
41
42
Note: See TracBrowser for help on using the repository browser.