Last change
on this file since 11154 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 | """ |
---|
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 | 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') |
---|
39 | return session_id |
---|
40 | |
---|
41 | |
---|
42 | |
---|
Note: See
TracBrowser for help on using the repository browser.