## Script (Python) "import_uploads" ##bind container=container ##bind context=context ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath ##parameters=student=None ##title= ## # $Id:import_uploads.py 486 2006-09-06 10:09:39Z joachim $ """ do the import for uploads """ try: from Products.zdb import set_trace except: def set_trace(): pass request = context.REQUEST import DateTime, logging from urllib import urlencode current = DateTime.DateTime() pr = context.portal_registration logger = logging.getLogger('Skins.import_uploads') mtool = context.portal_membership member = mtool.getAuthenticatedMember() #set_trace() lt = context.portal_layouts #pr = context.portal_registration ids = request.get('ids',[]) bypass_enabled = False messages = [] for long_id in ids: short_id = long_id.replace('.csv','') doc = getattr(context, long_id).getContent() msg, invalid_keys = doc['checkKeys']() if msg or invalid_keys: continue if not bypass_enabled: context.portal_catalog.setBypassQueue(1) msg = context.waeup_tool.importData(short_id, doc.import_layout, ) logger.info(msg) messages += msg, if bypass_enabled: context.portal_catalog.setBypassQueue(0) args = {} args['portal_status_message'] = '\r\n'.join(messages) url = context.absolute_url() + '?' + urlencode(args) request.RESPONSE.redirect(url)