Index: WAeUP_SRP/base/skins/waeup_utilities/fillApplicationCategory.py
===================================================================
--- WAeUP_SRP/base/skins/waeup_utilities/fillApplicationCategory.py	(revision 3436)
+++ WAeUP_SRP/base/skins/waeup_utilities/fillApplicationCategory.py	(revision 3436)
@@ -0,0 +1,65 @@
+## Script (Python) "ti_507_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.fillApplicationCategory')
+from Products.AdvancedQuery import Eq, Between, Le,In
+#aq_students = context.students_catalog.evalAdvancedQuery
+aq_portal = context.portal_catalog_real.evalAdvancedQuery
+#students_folder = context.portal_url.getPortalObject().campus.students
+
+request = context.REQUEST
+session = request.SESSION
+response = request.RESPONSE
+setheader = request.RESPONSE.setHeader
+logger.info('start')
+count = 0
+found = 0
+commit_after = 1000
+#certificates = context.getCertificatesDict()
+certificates = context.portal_catalog.search({'meta_type': "Certificate"})
+logger.info("found %d certificates" % len(certificates))
+cat = {'cos': 'BASIC',
+       'cos_cest': 'CEST',
+       'cos_sandwich': 'SANDWICH',
+       }
+to_change = {}
+for cert in certificates:
+    found = []
+    for v in ('cos','cos_cest','cos_sandwich'):
+        voc = getattr(context.portal_vocabularies,v)
+        if cert.id in voc.keys():
+            found += v,
+    if found:
+        d = {}
+        d['application_category'] = cat[found[0]]
+        d['cert_doc'] = cert.getObject().getContent()
+        to_change[cert.id] = d
+        logger.info("%s in %s" % (cert.id,','.join(found)))
+        count += 1
+for cert,d in to_change.items():
+    d['cert_doc'].edit(mapping = d)
+    logger.info("set application_category of %s to %s" % 
+               (cert,d['application_category']))
+logger.info("found %d not in vocabularies" % count)
