Last change
on this file since 2670 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 | """ |
---|
12 | return fixed session_id from level |
---|
13 | """ |
---|
14 | try: |
---|
15 | from Products.zdb import set_trace |
---|
16 | except: |
---|
17 | def set_trace(): |
---|
18 | pass |
---|
19 | import logging |
---|
20 | logger = logging.getLogger('Skins.getLevelSession') |
---|
21 | session_id = level_doc.session |
---|
22 | changed = False |
---|
23 | if len(session_id) == 2: |
---|
24 | pass |
---|
25 | elif len(session_id) == 9: |
---|
26 | changed = True |
---|
27 | session_id = session_id[2:4] |
---|
28 | if len(session_id) != 2: |
---|
29 | logger.info("invalid session %s in level %s for student %s" % |
---|
30 | (session_id,level_id,student_id)) |
---|
31 | else: |
---|
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') |
---|
36 | return session_id |
---|
37 | |
---|
38 | |
---|
39 | |
---|
Note: See
TracBrowser for help on using the repository browser.