##parameters=REQUEST # $Id: pay_hostel_fee.py 166 2005-11-12 14:45:08Z joachim $ """ book an accomodation """ import DateTime current = DateTime.DateTime() type_name = 'Student' ti = context.portal_types[type_name] pm = context.portal_membership REQUEST.set('type_name',type_name) validate = REQUEST.has_key("cpsdocument_edit_button") lt = context.portal_layouts pr = context.portal_registration res,psm,ds = lt.renderLayout(layout_id= 'accopay', schema_id= 'student_hostel_fee', context=context, mapping=validate and REQUEST, ob={}, layout_mode='create', submit = "pay", action = 'pay_hostel_fee', ) if psm == 'invalid': return context.book_accommodation_form(rendered = res, psm = "Please correct your input", ds = ds, ) elif psm == '': return context.book_accommodation_form(rendered = res, psm = None, ds = ds, ) elif psm == 'valid': sf = context.getContent() ds.set('sc_date',current) sf.setScratchCardData('hostel_fee',ds) return context.payed_hostel_fee(dict=ds)