source: WAeUP_SRP/branches/regebro-noskins/skins/waeup_directory/member_delete.py

Last change on this file was 953, checked in by Henrik Bettermann, 18 years ago

member directory acl permission, schema and layouts changed
not yet optimized

File size: 1.2 KB
Line 
1##parameters=dirname=None, id=None, ids=[], REQUEST=None
2# $Id: member_delete.py 21607 2005-05-17 08:36:35Z atchertchian $
3"""
4This script can be both called with request parameters or with form parameters
5"""
6
7from zLOG import LOG, DEBUG
8logKey = 'member_delete'
9
10if REQUEST is not None:
11    psm = 'psm_entry_deleted'
12    if REQUEST.form.has_key('dirname'):
13        dirname = REQUEST.form.get('dirname')
14        #LOG(logKey, DEBUG, "dirname = %s" % dirname)
15
16    if REQUEST.form.get('ids'):
17        ids = REQUEST.form.get('ids')
18        #LOG(logKey, DEBUG, "ids = %s" % str(ids))
19
20dir = context.portal_directories[dirname]
21
22if id:
23    try:
24        dir.deleteEntry(id)
25    except ValueError, e:
26        msg = str(e)
27        if REQUEST is not None and \
28               msg.find("Operation not allowed on non-leaf") > 0:
29            psm = 'psm_entry_delete_not_allowed_on_non_leaf'
30        else:
31            raise
32
33if ids:
34    for id in ids:
35        dir.deleteEntry(id)
36
37if REQUEST is not None:
38    portal_url = context.portal_url()
39    REQUEST.RESPONSE.redirect('%s/search_members_form?dirname=%s'
40                              '&portal_status_message=%s' %
41                              (portal_url, dirname, psm))
Note: See TracBrowser for help on using the repository browser.