Index: WAeUP_SRP/base/skins/waeup_utilities/fix_lgas.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_utilities/fix_lgas.py	(revision 2979)
+++ 	(revision )
@@ -1,131 +1,0 @@
-## Script (Python) "fix_lgas"
-##bind container=container
-##bind context=context
-##bind namespace=
-##bind script=script
-##bind subpath=traverse_subpath
-##parameters=
-##title=
-##
-# $Id$
-"""
-"""
-try:
-    from Products.zdb import set_trace
-except:
-    def set_trace():
-        pass
-
-mtool = context.portal_membership
-member = mtool.getAuthenticatedMember()
-if str(member) not in ('admin','joachim'):
-    return
-
-
-import logging
-import DateTime
-logger = logging.getLogger('Skins.fix_lgas')
-from Products.AdvancedQuery import Eq, Between, Le,In
-aq_portal = context.portal_catalog_real.evalAdvancedQuery
-aq_students = context.students_catalog.evalAdvancedQuery
-students_folder = context.portal_url.getPortalObject().campus.students
-
-request = context.REQUEST
-session = request.SESSION
-response = request.RESPONSE
-setheader = request.RESPONSE.setHeader
-def rwrite(s):
-    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
-    response.write("%s<br>\n\r" % s)
-
-def getLGAs():
-    voc = getattr(context.portal_vocabularies,'local_gov_areas')
-    states = []
-    lgas  = []
-    d = {}
-    for k,v in voc.items():
-        parts = v.split(' / ')
-        if len(parts) == 1:
-            state = parts[0].lower()
-            lga = ""
-        elif len(parts) == 2:
-            state = parts[0].lower()
-            lga = "_".join(parts[1].lower().split())
-        else:
-            continue
-        if state not in states:
-            states.append(state)
-        if lga not in lgas:
-            lgas.append(lga)
-        d[k] = v
-    return (d,states,lgas)
-
-#logger.info('')
-student_records = context.students_catalog()
-total = len(student_records)
-logger.info("found %d students" % total)
-count = 0
-commit_after = 100
-logger.info('started to fix %d records in students_catalog' % total)
-d,states,lgas = getLGAs()
-d = {}
-for student_record in student_records:
-    if not student_record.lga:
-        continue
-    if student_record.lga.find('_') > -1:
-        continue
-    if student_record.lga.startswith('no state'):
-        logger.info("found invalid lga %s of %s" % (student_record.lga,student_record.id))
-        continue
-    #rwrite("%s: %s" % (student_record.id,student_record.lga))
-    sl = student_record.lga.split('/')
-    if len(sl) != 2:
-        logger.info("found invalid lga %s of %s" % (student_record.lga,student_record.id))
-        #rwrite("wrong size %s: %s" % (student_record.id,sl))
-        continue
-    state = sl[0].lower().strip()
-    lga = sl[1].lower().strip()
-    if not lga or not state:
-        logger.info("found invalid lga %s of %s" % (student_record.lga,student_record.id))
-        continue
-    count += 1
-    if len(d) and not len(d)  % commit_after:
-        logger.info("found %d correct of %d so far" % (len(d),count))
-    state_lga = state + '_' + lga
-    if state in states:
-        found = False
-        while True:
-            if lga in lgas:
-                found = True
-                break
-            lga = lga.replace(' ','-')
-            if lga in lgas:
-                found = True
-            break
-        if found:
-            #msg = "found %s for %s" % (state_lga,student_record.id)
-            d[student_record.id] = state_lga
-        #else:
-            #msg = "no '%s' '%s' for %s" % (state,lga,student_record.id)
-            #rwrite(msg)
-    #else:
-        #msg = "no state '%s' '%s' for %s" % (state,lga,student_record.id)
-        #rwrite(msg)
-    # if count > 150:
-    #     break
-to_edit = len(d)
-logger.info("found %d correct lgas of %d" % (to_edit,count))
-#return
-
-edited = 1
-for student_id,lga in d.items():
-    msg = "set clearance.lga to %s for %s" % (lga,student_id)
-    getattr(getattr(students_folder,student_id),'clearance').getContent().edit(mapping={'lga':lga})
-    logger.info(msg)
-    edited += 1
-    if edited and not edited  % commit_after:
-        context.waeup_tool.doCommit()
-        logger.info("Committing %d,  %d of %d" % (commit_after,edited,to_edit))
-logger.info('finished, %d checked, %d edited' % (count,
-                                               edited,))
-
Index: WAeUP_SRP/base/skins/waeup_utilities/ti_441_resolve.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_utilities/ti_441_resolve.py	(revision 2979)
+++ 	(revision )
@@ -1,102 +1,0 @@
-## Script (Python) "ti_441_resolve"
-##bind container=container
-##bind context=context
-##bind namespace=
-##bind script=script
-##bind subpath=traverse_subpath
-##parameters=
-##title=
-##
-# $Id$
-"""
-"""
-try:
-    from Products.zdb import set_trace
-except:
-    def set_trace():
-        pass
-
-mtool = context.portal_membership
-member = mtool.getAuthenticatedMember()
-if str(member) not in ('admin','joachim'):
-    return
-
-
-import logging
-import DateTime
-logger = logging.getLogger('Skins.ti_441_resolve')
-from Products.AdvancedQuery import Eq, Between, Le,In
-aq_portal = context.portal_catalog_real.evalAdvancedQuery
-aq_students = context.students_catalog.evalAdvancedQuery
-students_folder = context.portal_url.getPortalObject().campus.students
-
-request = context.REQUEST
-session = request.SESSION
-response = request.RESPONSE
-setheader = request.RESPONSE.setHeader
-def rwrite(s):
-    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
-    response.write("%s<br>\n\r" % s)
-
-def getLGAs():
-    voc = getattr(context.portal_vocabularies,'local_gov_areas')
-    states = []
-    lgas  = []
-    d = {}
-    for k,v in voc.items():
-        parts = v.split(' / ')
-        if len(parts) == 1:
-            state = parts[0].lower()
-            lga = ""
-        elif len(parts) == 2:
-            state = parts[0].lower()
-            lga = "_".join(parts[1].lower().split())
-        else:
-            continue
-        if state not in states:
-            states.append(state)
-        if lga not in lgas:
-            lgas.append(lga)
-        d[k] = v
-    return (d,states,lgas)
-
-#logger.info('')
-query = Eq('lga','')
-student_records = aq_students(query)
-total = len(student_records)
-logger.info("found %d records with empty clearance lga" % total)
-count = 0
-commit_after = 100
-logger.info('started to fix %d records' % total)
-d,states,lgas = getLGAs()
-d = {}
-for student_record in student_records:
-    count += 1
-    if len(d) and not len(d)  % commit_after:
-        logger.info("found %d correct lga values of %d so far" % (len(d),count))
-    jamb_state = getattr(getattr(students_folder,student_record.id),'application').getContent().jamb_state
-    jamb_lga = getattr(getattr(students_folder,student_record.id),'application').getContent().jamb_lga
-    jamb_state = jamb_state.lower()
-    jamb_lga = jamb_lga.lower()
-    lga = jamb_state + '_' + jamb_lga
-    if jamb_state and jamb_lga and jamb_state in states and jamb_lga in lgas:
-        d[student_record.id] = lga
-    #else:
-    #    msg = "no %s for %s" % (lga,student_record.id)
-    #    pass
-    # rwrite(msg)
-    # if count > 150:
-    #     break
-logger.info("found %d correct lga values" % len(d))
-edited = 1
-for student_id,lga in d.items():
-    msg = "set clearance.lga to %s for %s" % (lga,student.id)
-    getattr(getattr(students_folder,student_id),'clearance').getContent().edit(mapping={'lga':lga})
-    logger.info(msg)
-    edited += 1
-    if edited and not edited  % commit_after:
-        context.waeup_tool.doCommit()
-        logger.info("Committing %d,  %d" % (commit_after,edited))
-logger.info('finished, %d checked, %d edited' % (count,
-                                               edited,))
-
Index: WAeUP_SRP/base/skins/waeup_utilities/ti_441_resolve_part1.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_utilities/ti_441_resolve_part1.py	(revision 2980)
+++ WAeUP_SRP/base/skins/waeup_utilities/ti_441_resolve_part1.py	(revision 2980)
@@ -0,0 +1,102 @@
+## Script (Python) "ti_441_resolve_part1"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id: ti_441_resolve.py 2979 2008-01-05 15:01:33Z henrik $
+"""
+"""
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+if str(member) not in ('admin','joachim'):
+    return
+
+
+import logging
+import DateTime
+logger = logging.getLogger('Skins.ti_441_resolve')
+from Products.AdvancedQuery import Eq, Between, Le,In
+aq_portal = context.portal_catalog_real.evalAdvancedQuery
+aq_students = context.students_catalog.evalAdvancedQuery
+students_folder = context.portal_url.getPortalObject().campus.students
+
+request = context.REQUEST
+session = request.SESSION
+response = request.RESPONSE
+setheader = request.RESPONSE.setHeader
+def rwrite(s):
+    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+    response.write("%s<br>\n\r" % s)
+
+def getLGAs():
+    voc = getattr(context.portal_vocabularies,'local_gov_areas')
+    states = []
+    lgas  = []
+    d = {}
+    for k,v in voc.items():
+        parts = v.split(' / ')
+        if len(parts) == 1:
+            state = parts[0].lower()
+            lga = ""
+        elif len(parts) == 2:
+            state = parts[0].lower()
+            lga = "_".join(parts[1].lower().split())
+        else:
+            continue
+        if state not in states:
+            states.append(state)
+        if lga not in lgas:
+            lgas.append(lga)
+        d[k] = v
+    return (d,states,lgas)
+
+#logger.info('')
+query = Eq('lga','')
+student_records = aq_students(query)
+total = len(student_records)
+logger.info("found %d records with empty clearance lga" % total)
+count = 0
+commit_after = 100
+logger.info('started to fix %d records' % total)
+d,states,lgas = getLGAs()
+d = {}
+for student_record in student_records:
+    count += 1
+    if len(d) and not len(d)  % commit_after:
+        logger.info("found %d correct lga values of %d so far" % (len(d),count))
+    jamb_state = getattr(getattr(students_folder,student_record.id),'application').getContent().jamb_state
+    jamb_lga = getattr(getattr(students_folder,student_record.id),'application').getContent().jamb_lga
+    jamb_state = jamb_state.lower()
+    jamb_lga = jamb_lga.lower()
+    lga = jamb_state + '_' + jamb_lga
+    if jamb_state and jamb_lga and jamb_state in states and jamb_lga in lgas:
+        d[student_record.id] = lga
+    #else:
+    #    msg = "no %s for %s" % (lga,student_record.id)
+    #    pass
+    # rwrite(msg)
+    # if count > 150:
+    #     break
+logger.info("found %d correct lga values" % len(d))
+edited = 1
+for student_id,lga in d.items():
+    msg = "set clearance.lga to %s for %s" % (lga,student.id)
+    getattr(getattr(students_folder,student_id),'clearance').getContent().edit(mapping={'lga':lga})
+    logger.info(msg)
+    edited += 1
+    if edited and not edited  % commit_after:
+        context.waeup_tool.doCommit()
+        logger.info("Committing %d,  %d" % (commit_after,edited))
+logger.info('finished, %d checked, %d edited' % (count,
+                                               edited,))
+
Index: WAeUP_SRP/base/skins/waeup_utilities/ti_441_resolve_part2.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_utilities/ti_441_resolve_part2.py	(revision 2980)
+++ WAeUP_SRP/base/skins/waeup_utilities/ti_441_resolve_part2.py	(revision 2980)
@@ -0,0 +1,131 @@
+## Script (Python) "ti_441_resolve_part2"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id: fix_lgas.py 2979 2008-01-05 15:01:33Z henrik $
+"""
+"""
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+if str(member) not in ('admin','joachim'):
+    return
+
+
+import logging
+import DateTime
+logger = logging.getLogger('Skins.fix_lgas')
+from Products.AdvancedQuery import Eq, Between, Le,In
+aq_portal = context.portal_catalog_real.evalAdvancedQuery
+aq_students = context.students_catalog.evalAdvancedQuery
+students_folder = context.portal_url.getPortalObject().campus.students
+
+request = context.REQUEST
+session = request.SESSION
+response = request.RESPONSE
+setheader = request.RESPONSE.setHeader
+def rwrite(s):
+    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+    response.write("%s<br>\n\r" % s)
+
+def getLGAs():
+    voc = getattr(context.portal_vocabularies,'local_gov_areas')
+    states = []
+    lgas  = []
+    d = {}
+    for k,v in voc.items():
+        parts = v.split(' / ')
+        if len(parts) == 1:
+            state = parts[0].lower()
+            lga = ""
+        elif len(parts) == 2:
+            state = parts[0].lower()
+            lga = "_".join(parts[1].lower().split())
+        else:
+            continue
+        if state not in states:
+            states.append(state)
+        if lga not in lgas:
+            lgas.append(lga)
+        d[k] = v
+    return (d,states,lgas)
+
+#logger.info('')
+student_records = context.students_catalog()
+total = len(student_records)
+logger.info("found %d students" % total)
+count = 0
+commit_after = 100
+logger.info('started to fix %d records in students_catalog' % total)
+d,states,lgas = getLGAs()
+d = {}
+for student_record in student_records:
+    if not student_record.lga:
+        continue
+    if student_record.lga.find('_') > -1:
+        continue
+    if student_record.lga.startswith('no state'):
+        logger.info("found invalid lga %s of %s" % (student_record.lga,student_record.id))
+        continue
+    #rwrite("%s: %s" % (student_record.id,student_record.lga))
+    sl = student_record.lga.split('/')
+    if len(sl) != 2:
+        logger.info("found invalid lga %s of %s" % (student_record.lga,student_record.id))
+        #rwrite("wrong size %s: %s" % (student_record.id,sl))
+        continue
+    state = sl[0].lower().strip()
+    lga = sl[1].lower().strip()
+    if not lga or not state:
+        logger.info("found invalid lga %s of %s" % (student_record.lga,student_record.id))
+        continue
+    count += 1
+    if len(d) and not len(d)  % commit_after:
+        logger.info("found %d correct of %d so far" % (len(d),count))
+    state_lga = state + '_' + lga
+    if state in states:
+        found = False
+        while True:
+            if lga in lgas:
+                found = True
+                break
+            lga = lga.replace(' ','-')
+            if lga in lgas:
+                found = True
+            break
+        if found:
+            #msg = "found %s for %s" % (state_lga,student_record.id)
+            d[student_record.id] = state_lga
+        #else:
+            #msg = "no '%s' '%s' for %s" % (state,lga,student_record.id)
+            #rwrite(msg)
+    #else:
+        #msg = "no state '%s' '%s' for %s" % (state,lga,student_record.id)
+        #rwrite(msg)
+    # if count > 150:
+    #     break
+to_edit = len(d)
+logger.info("found %d correct lgas of %d" % (to_edit,count))
+#return
+
+edited = 1
+for student_id,lga in d.items():
+    msg = "set clearance.lga to %s for %s" % (lga,student_id)
+    getattr(getattr(students_folder,student_id),'clearance').getContent().edit(mapping={'lga':lga})
+    logger.info(msg)
+    edited += 1
+    if edited and not edited  % commit_after:
+        context.waeup_tool.doCommit()
+        logger.info("Committing %d,  %d of %d" % (commit_after,edited,to_edit))
+logger.info('finished, %d checked, %d edited' % (count,
+                                               edited,))
+
