Last change
on this file since 1418 was
805,
checked in by joachim, 18 years ago
|
propset Id
|
-
Property svn:keywords set to
Id
|
File size:
1.4 KB
|
Line | |
---|
1 | ## Script (Python) "folder_delete" |
---|
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 |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | # $Id: hall_delete.py 805 2006-11-09 09:38:29Z joachim $ |
---|
11 | """ |
---|
12 | FIXME: add docstring. |
---|
13 | """ |
---|
14 | |
---|
15 | from Products.CMFCore.utils import getToolByName |
---|
16 | here = context |
---|
17 | if context.portal_type == "University": |
---|
18 | here = context.academics |
---|
19 | |
---|
20 | ti = getToolByName(here, 'portal_types').getTypeInfo(here.portal_type) |
---|
21 | meth_id = ti.queryMethodID('view', 'folder_contents') |
---|
22 | ret_url = here.absolute_url() + '/' + meth_id |
---|
23 | pa = context.portal_accommodation |
---|
24 | |
---|
25 | if ids: |
---|
26 | halls = [] |
---|
27 | for id in ids: |
---|
28 | # XXX has to be called from here since the workflow doesn't handle the |
---|
29 | # deletion yet |
---|
30 | halls.append(id) |
---|
31 | ob = getattr(here, id) |
---|
32 | from Products.CPSCore.EventServiceTool import getPublicEventService |
---|
33 | evtool = getPublicEventService(here) |
---|
34 | evtool.notifyEvent('workflow_delete', ob, {}) |
---|
35 | beds = pa(hall=id) |
---|
36 | urls = [] |
---|
37 | for bed in beds: |
---|
38 | urls.append(bed.bed) |
---|
39 | for url in urls: |
---|
40 | pa.deleteRecord(url) |
---|
41 | here.manage_delObjects(ids) |
---|
42 | message = 'portal_status_message=hall(s) %s with %s beds deleted' % (" ".join(halls),len(urls)) |
---|
43 | else: |
---|
44 | message = 'portal_status_message=psm_select_at_least_one_document' |
---|
45 | |
---|
46 | if REQUEST is not None: |
---|
47 | return REQUEST.RESPONSE.redirect(ret_url + '?' + message) |
---|
Note: See
TracBrowser for help on using the repository browser.