Last change
on this file since 17950 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 | """ |
---|
13 | try: |
---|
14 | from Products.zdb import set_trace |
---|
15 | except: |
---|
16 | def set_trace(): |
---|
17 | pass |
---|
18 | |
---|
19 | mtool = context.portal_membership |
---|
20 | member = mtool.getAuthenticatedMember() |
---|
21 | if str(member) not in ('admin','joachim'): |
---|
22 | return |
---|
23 | |
---|
24 | |
---|
25 | import logging |
---|
26 | import DateTime |
---|
27 | logger = logging.getLogger('Skins.cleanPaymentsCatalog') |
---|
28 | |
---|
29 | count = 1 |
---|
30 | d = {} |
---|
31 | l = [] |
---|
32 | sum_total = 0.0 |
---|
33 | log_after = 100 |
---|
34 | logger.info("start") |
---|
35 | |
---|
36 | |
---|
37 | payments = context.payments_catalog() |
---|
38 | count = 0 |
---|
39 | total = 0 |
---|
40 | to_del = [] |
---|
41 | |
---|
42 | for 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 | |
---|
49 | for uid in to_del: |
---|
50 | context.payments_catalog.deleteRecord(uid) |
---|
51 | logger.info("%s deleted" % (uid)) |
---|
52 | |
---|
53 | |
---|
54 | logger.info("%d of %d payment records deleted" % (count,total)) |
---|
Note: See
TracBrowser for help on using the repository browser.