source: WAeUP_SRP/trunk/skins/waeup_utilities/removeLinefeed.py @ 8794

Last change on this file since 8794 was 3992, checked in by Henrik Bettermann, 16 years ago

remove line feeds in per_address

File size: 1.1 KB
Line 
1## Script (Python) "removeLinefeed"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10# $Id: removeLinefeed.py 3132 2008-02-08 21:10:38Z henrik $
11"""
12"""
13try:
14    from Products.zdb import set_trace
15except:
16    def set_trace():
17        pass
18
19mtool = context.portal_membership
20member = mtool.getAuthenticatedMember()
21if str(member) not in ('admin'):
22    return
23
24import logging
25import DateTime
26logger = logging.getLogger('Skins.removeLinefeed')
27students = context.students_catalog()
28counter = 0
29for student in students:
30    counter += 1
31    sid = student.id
32    perm_address = student.perm_address
33    if perm_address and '\n' in perm_address:
34        try:
35            perm_address_new = perm_address.replace('\n',' ')
36            context.students_catalog.modifyRecord(id = sid,
37                                                  perm_address = perm_address_new)       
38            logger.info('%d: %s, %s' % (counter, sid, perm_address_new))
39        except:
40            logger.info('%s failed' % (sid))
41            continue
42return 'finished!'
43
44
Note: See TracBrowser for help on using the repository browser.