source: WAeUP_SRP/branches/uli/skins/waeup_student/paid_transfer_list.py

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

export list

File size: 1.5 KB
Line 
1## Script (Python) "paid_transfer_list"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=student=None
8##title=
9##
10# $Id: hall_allocation_list.py 1273 2007-01-11 18:28:49Z joachim $
11"""
12export students who paid for the transfer form
13"""
14request = context.REQUEST
15setheader = request.RESPONSE.setHeader
16scat = context.students_catalog
17fields = ("id",
18          "name",
19          "matric_no",
20          "jamb_reg_no",
21          "sex",
22          "email",
23          "phone",
24          "faculty",
25          "department",
26          "course",
27          "level",
28          )
29res_list = []
30lines = []
31lines.append(','.join(fields))
32format = '"%(' + ')s","%('.join(fields) + ')s"'
33
34payments = context.portal_catalog(portal_type='Payment')
35
36for payment in payments:
37    if not payment.id.startswith('transfer'):
38        continue
39    sid = payment.getPath().split('/')[-3]
40    erg = scat(id=sid)
41    if not erg:
42        continue
43    d = context.getFormattedStudentEntry(erg[0])
44    lines.append(format % d)
45
46#setheader('Content-type', 'text/x-cvs')
47#setheader('Content-type','application/vnd.ms-excel')
48setheader('Content-type','text/semicolon-seperated-values')
49setheader('Content-Disposition:', 'attachment; filename="transfer_list.csv"')
50setheader('Expires',  'Mon, 26 Jul 1997 05:00:00GMT') # Date in the past
51setheader('Cache-Control', 'no-store, no-cache,must-revalidate') # HTTP/1.1
52setheader('Cache-Control', 'post-check=0,pre-check=0')
53setheader('Pragma', 'no-cache') # HTTP/1.0
54return '\n'.join(lines)
55
Note: See TracBrowser for help on using the repository browser.