source: WAeUP_SRP/base/skins/waeup_upload/import_uploads.py @ 3306

Last change on this file since 3306 was 3296, checked in by joachim, 17 years ago

add missing

  • Property svn:keywords set to Id
File size: 1.4 KB
Line 
1## Script (Python) "import_uploads"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=student=None
8##title=
9##
10# $Id:import_uploads.py 486 2006-09-06 10:09:39Z joachim $
11"""
12do the import for uploads
13"""
14try:
15    from Products.zdb import set_trace
16except:
17    def set_trace():
18        pass
19request = context.REQUEST
20import DateTime, logging
21from urllib import urlencode
22current = DateTime.DateTime()
23pr = context.portal_registration
24
25logger = logging.getLogger('Skins.import_uploads')
26mtool = context.portal_membership
27member = mtool.getAuthenticatedMember()
28
29#set_trace()
30lt = context.portal_layouts
31#pr = context.portal_registration
32
33ids = request.get('ids',[])
34
35bypass_enabled = False
36messages = []
37for long_id in ids:
38    short_id = long_id.replace('.csv','')
39    doc = getattr(context, long_id).getContent()
40    msg, invalid_keys = doc['checkKeys']()
41    if msg or invalid_keys:
42        continue
43    if not bypass_enabled:
44        context.portal_catalog.setBypassQueue(1)
45    msg = context.waeup_tool.importData(short_id,
46                                        doc.import_layout,
47                                       )
48    logger.info(msg)
49    messages += msg,
50
51if bypass_enabled:
52    context.portal_catalog.setBypassQueue(0)
53args = {}
54args['portal_status_message'] = '\r\n'.join(messages)
55url = context.absolute_url() + '?' + urlencode(args)
56request.RESPONSE.redirect(url)   
57   
58
Note: See TracBrowser for help on using the repository browser.