Index: WAeUP_SRP/trunk/skins/waeup_student/apply_admission.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/apply_admission.py	(revision 486)
+++ WAeUP_SRP/trunk/skins/waeup_student/apply_admission.py	(revision 488)
@@ -18,10 +18,9 @@
 pr = context.portal_registration
 
-prefix = 'APP'
 res,psm,ds = lt.renderLayout(layout_id= 'student_application_fe',
                       schema_id= 'student_application',
                       context=context,
                       mapping=validate and REQUEST,
-                      ob={'app_ac_prefix': prefix},
+                      ob={},
                       layout_mode='create',
                       formaction = "apply_admission",
@@ -31,5 +30,5 @@
     return context.application_pin_form(rendered = res,
                                  psm = "Please correct your input.",
-                                 #psm = "psm : #%s#" % (psm,),
+                                 #psm = "%s, %s" % (psm,ds),
                                  firstlayout = True,
                                  lastlayout = True,
@@ -45,17 +44,13 @@
 elif psm == 'valid':
     jamb_id = ds.get('jamb_reg_no')
-    catalog = context.portal_catalog
-    search = catalog({'meta_type': 'StudentApplication',
-                     'jamb_reg_no': jamb_id
-                     })
-
-    if len(search) < 1:
-        psm = "JAMB record %s not found." % (jamb_id)
+    student = context.getContent().getStudentByRegNo(jamb_id)
+    if student is None:
+        psm = "JAMB record %s not accessible." % (jamb_id)
         return context.application_pin_form(rendered = res,
                                  psm = psm,
+                                 #psm = "%s, %s" % (psm,ds),
                                  ds = ds,
                                  )
-application = search[0].getObject()
-student = application.aq_parent
+application = student.application
 if context.portal_workflow.getInfoFor(student,'review_state',None) == "created":
     #student.invokeFactory('StudentClearance','clearance')
@@ -80,6 +75,4 @@
 student.personal.getContent().edit(mapping = dp)
 da = {}
-da['app_ac_prefix'] = prefix
-da['app_ac_batch_no'] = ds.get('app_ac_batch_no')
 da['app_ac_pin'] = ds.get('app_ac_pin')
 da['app_ac_date'] = current
Index: WAeUP_SRP/trunk/skins/waeup_student/scratch_card_batch_create_do.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/scratch_card_batch_create_do.py	(revision 486)
+++ WAeUP_SRP/trunk/skins/waeup_student/scratch_card_batch_create_do.py	(revision 488)
@@ -5,29 +5,25 @@
 
 Datamodel may be examined to create a suitable id.
-
-Returns the created object (usually a proxy).
 """
 from Products.CMFCore.utils import getToolByName
 
-id = datamodel.get('prefix').upper()
-datamodel.set('prefix',id)
-bl = context.portal_catalog({'meta_type': "ScratchCardBatch"})
-b_ids = [b.getId(), for b in bl]
+prefix = datamodel.get('prefix').upper()
+datamodel.set('prefix',prefix)
+bl = context.portal_catalog({'meta_type': "ScratchCardBatch",})
+b_ids = []
+for b in bl:
+    b_ids.append(b.getId)
 next = 1
-while "%(prefix)s_%(next)d" % vars() in b_ids:
+while b_ids and "%s_%d" % (prefix,next) in b_ids:
     next += 1
-id = "%(prefix)s_%(next)d" % vars()
-##if not id:
-##    id = 'my ' + type_name
-##id = context.computeId(compute_from=id) # XXX shouldn't use a skin
-##
-language = datamodel.get('Language')
-if not language:
-    ts = getToolByName(context, 'translation_service')
-    language = ts.getSelectedLanguage()
+id = "%s_%d" % (prefix,next)
+datamodel.set('batch_no',next)
+##language = datamodel.get('Language')
+##if not language:
+##    ts = getToolByName(context, 'translation_service')
+##    language = ts.getSelectedLanguage()
 
 # Datamodel is passed so that flexti can initialize the object.
 new_id = context.invokeFactory(type_name, id, datamodel=datamodel,
-                               language=language,
                                )
 if new_id is not None:
Index: WAeUP_SRP/trunk/skins/waeup_student/scratch_card_batch_created.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_student/scratch_card_batch_created.py	(revision 486)
+++ WAeUP_SRP/trunk/skins/waeup_student/scratch_card_batch_created.py	(revision 488)
@@ -1,4 +1,14 @@
-##parameters=
+## Script (Python) "cpsdocument_created"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=object=None
+##title=
+##
 # $Id$
-
+if object is not None:
+    batch = object
+batch.getContent().makePins()
 return
