source: WAeUP_SRP/trunk/skins/waeup_accommodation/hall_allocation_list.py @ 1271

Last change on this file since 1271 was 1271, checked in by joachim, 18 years ago

remove '

  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1## Script (Python) "hall_allocation_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 1271 2007-01-11 17:49:57Z joachim $
11"""
12export hall_allocation_list
13"""
14request = context.REQUEST
15setheader = request.RESPONSE.setHeader
16pa = context.portal_accommodation
17scat = context.students_catalog
18st_schema = context.students_catalog.schema()
19#fields = list(st_schema) + ["bed",]
20fields = ("id",
21          "name",
22          "bed",
23          "matric_no",
24          "jamb_reg_no",
25          "sex",
26          "email",
27          "phone",
28          "faculty",
29          "department",
30          "course",
31          "level",
32          )
33res_list = []
34lines = []
35lines.append(','.join(fields))
36format = '"%(' + ')s","%('.join(fields) + ')s"'
37reserved = pa(hall=context.getId())
38for bed in reserved:
39    if bed.student == '':
40        continue
41    erg = scat(id=bed.student)
42    if not erg:
43        continue
44    d = context.getFormattedStudentEntry(erg[0])
45    d['bed'] = bed.bed
46    lines.append(format % d)
47#setheader('Content-type', 'text/x-cvs')
48#setheader('Content-type','application/vnd.ms-excel')
49setheader('Content-type','text/semicolon-seperated-values')
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)
Note: See TracBrowser for help on using the repository browser.