Index: WAeUP_SRP/trunk/skins/waeup_student/getAccommodationInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/getAccommodationInfo.py	(revision 1100)
+++ WAeUP_SRP/trunk/skins/waeup_student/getAccommodationInfo.py	(revision 1100)
@@ -0,0 +1,78 @@
+## Script (Python) "getStudentInfo"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=student_id=None
+##title=
+##
+# $Id$
+"""
+return Info about the current Student
+"""
+import logging
+logger = logging.getLogger('Student.Accommodation.Info')
+import DateTime
+
+request = context.REQUEST
+mtool = context.portal_membership
+wf = context.portal_workflow
+member = mtool.getAuthenticatedMember()
+member_id = str(member)
+path_info = request.get('PATH_INFO').split('/')
+
+if mtool.isAnonymousUser():
+    return None
+info = {}
+if student_id is None:
+    requested_id = context.getStudentId()
+    if requested_id and not context.isStaff() and member_id != requested_id:
+        logger.info('"%s", "tried to access", "%s"' % (member_id,requested_id))
+        return None
+    elif context.isStaff():
+        student_id = requested_id
+    else:
+        student_id = member_id
+
+res = context.students_catalog(id=student_id)
+if len(res) != 1:
+    logger.info('"%s","not found in students_catalog"')
+    return None
+ekehuan_certificates = ('BARTAPG',
+                        'BARTAPM',
+                        'BARTCER',
+                        'BARTFAA',
+                        'BARTFAP',
+                        'BARTSCP',
+                        'BARTTXT',
+                        'BARTMAS',
+                        'BARTTHR',
+                        )
+
+s_brain = res[0]
+students_object = context.portal_url.getPortalObject().campus.students
+student = getattr(students_object, student_id)
+info['id'] = student_id
+info['student'] = student
+info['review_state'] = wf.getInfoFor(student,'review_state',None)
+acco_id = 'accommodation_2006'
+acco = getattr(student,acco_id,None)
+info['acco'] = acco
+info['acco_id'] = acco_id
+if acco is not None:
+    info['acco_doc'] = acco.getContent()
+    info['acco_review_state'] = wf.getInfoFor(acco,'review_state',None)
+d = {}
+bt = 'fr'
+d['sex'] = 'male'
+if s_brain.sex:
+    d['sex'] = 'female'
+if s_brain.course in ekehuan_certificates:
+    bt += "_ekenhuan"
+d['bt'] = bt
+#from Products.zdb import set_trace
+#set_trace()
+student_status = "%(sex)s_%(bt)s" % d 
+info['student_status'] = student_status
+return info
Index: WAeUP_SRP/trunk/skins/waeup_student/reserve_accommodation.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/reserve_accommodation.py	(revision 1099)
+++ WAeUP_SRP/trunk/skins/waeup_student/reserve_accommodation.py	(revision 1100)
@@ -2,28 +2,19 @@
 # $Id$
 """
-process the Application Form
-return html renderer + psm
+process the the accommodation reservation
 """
 import DateTime
-
 current = DateTime.DateTime()
 pr = context.portal_registration
 wftool = context.portal_workflow
-
-info = context.getStudentInfo()
-validate = REQUEST.has_key("cpsdocument_create_button")
-#           REQUEST.has_key("cpsdocument_edit_button")
-
 lt = context.portal_layouts
-pr = context.portal_registration
-session = current.year()
-acco_id = 'accommodation_%s' % session
-info = context.getStudentInfo()
+info = context.getAccommodationInfo()
 student = info['student']
+acco_id = info['acco_id']
+session = acco_id[-4:]
 mode = 'create'
-
 if info['review_state'] != 'cleared_and_validated':
     return context.REQUEST.RESPONSE.redirect("%s/no_booking_allowed" % info['student'].absolute_url())
-
+validate = REQUEST.has_key("cpsdocument_create_button")
 if info.has_key('acco') and info['acco']:
     validate = REQUEST.has_key("cpsdocument_edit_button")
@@ -69,5 +60,6 @@
         pin = str(ds.get('acco_res_sc_pin'))
         pa = context.portal_accommodation
-        code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status')))
+        code,bed = pa.searchAndReserveBed(s_id,"%s" % (info['student_status']))
+        #code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status')))
         if code < 0:
             return context.accommodation_pin_edit_form(rendered = res,
@@ -84,4 +76,5 @@
         ds.set('bed', bed)
         ds.set('session', session)
+        ds.set('student_status',info['student_status'])
         acco.getContent().edit(mapping=ds)
         #wftool.doActionFor(acco,'pay_maintenance_fee',dest_container=acco)
