source: WAeUP_SRP/trunk/skins/waeup_utilities/cleanPaymentsCatalog.py @ 14872

Last change on this file since 14872 was 2922, checked in by Henrik Bettermann, 17 years ago

purge all payment records which start with 'p'

File size: 1.1 KB
Line 
1## Script (Python) "cleanPymentsCatalog.py"
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: upgradePayments.py 2918 2007-12-10 23:57:23Z 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','joachim'):
22    return
23
24
25import logging
26import DateTime
27logger = logging.getLogger('Skins.cleanPaymentsCatalog')
28
29count = 1
30d = {}
31l = []
32sum_total = 0.0
33log_after = 100
34logger.info("start")
35
36
37payments = context.payments_catalog()
38count = 0
39total = 0
40to_del = []
41
42for payment_brain in payments:
43    total += 1
44    logger.info("%s" % (payment_brain.order_id))
45    if payment_brain.order_id.startswith('p'):
46        to_del.append(payment_brain.order_id)
47        count += 1
48       
49for uid in to_del:
50    context.payments_catalog.deleteRecord(uid)       
51    logger.info("%s deleted" % (uid))
52       
53       
54logger.info("%d of %d payment records deleted" % (count,total))
Note: See TracBrowser for help on using the repository browser.