Last change
on this file since 1753 was
1597,
checked in by joachim, 18 years ago
|
merged changes 1588:1596 from trunk to joachim-event-branch
|
File size:
1.2 KB
|
Line | |
---|
1 | ## Script (Python) "delete_course_result" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters=ids=[], REQUEST=None, action_after_reject=None, action_after_validate=None |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | # $Id: delete_course_result.py 1557 2007-03-15 16:00:27Z joachim $ |
---|
11 | """ |
---|
12 | FIXME: add docstring. |
---|
13 | """ |
---|
14 | |
---|
15 | from Products.CMFCore.utils import getToolByName |
---|
16 | here = context |
---|
17 | from urllib import urlencode |
---|
18 | import logging |
---|
19 | logger = logging.getLogger('Skins.delete_course_result') |
---|
20 | mtool = context.portal_membership |
---|
21 | member = mtool.getAuthenticatedMember() |
---|
22 | |
---|
23 | ret_url = here.absolute_url() |
---|
24 | |
---|
25 | message = '' |
---|
26 | if ids: |
---|
27 | real_ids = [] |
---|
28 | for id in ids: |
---|
29 | if context.hasObject(id): |
---|
30 | real_ids.append(id) |
---|
31 | if real_ids: |
---|
32 | context.manage_delObjects(real_ids) |
---|
33 | logger.info('%s deleted StudentCourseResult object %s' % (member,id)) |
---|
34 | message = 'psm_item(s)_deleted' |
---|
35 | else: |
---|
36 | message = 'psm_select_at_least_one_document' |
---|
37 | |
---|
38 | args = {} |
---|
39 | args['portal_status_message'] = message |
---|
40 | url = context.absolute_url() + '/' + action_after_validate + '?' + urlencode(args) |
---|
41 | if REQUEST is not None: |
---|
42 | return REQUEST.RESPONSE.redirect(url) |
---|
Note: See
TracBrowser for help on using the repository browser.