source: WAeUP_SRP/trunk/skins/waeup_default/import.py @ 11102

Last change on this file since 11102 was 2315, checked in by Henrik Bettermann, 17 years ago

import.py fixed
logging in importData improved

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1##parameters=REQUEST
2# $Id: import.py 2315 2007-10-05 06:19:47Z henrik $
3"""
4process the Application Form
5return html renderer + psm
6"""
7try:
8    from Products.zdb import set_trace
9except:
10    def set_trace():
11        pass
12import DateTime, logging
13from urllib import urlencode
14current = DateTime.DateTime()
15pr = context.portal_registration
16
17logger = logging.getLogger('Skins.import')
18mtool = context.portal_membership
19member = mtool.getAuthenticatedMember()
20
21validate = REQUEST.has_key("import")
22enable = REQUEST.has_key("enable_bypass")
23disable = REQUEST.has_key("disable_bypass")
24#set_trace()
25lt = context.portal_layouts
26#pr = context.portal_registration
27
28res,psm,ds = lt.renderLayout(layout_id= 'import',
29                      schema_id= 'import',
30                      context=context,
31                      mapping=validate and REQUEST,
32                      ob={},
33                      layout_mode='create',
34                      commit=False,
35                      )
36if enable:
37    context.portal_catalog.setBypassQueue(1)
38    logger.info('%s enabled QueueCatalog Bypass' % (member))
39    psm = "QueueCatalog Bypass enabled!"
40    #return REQUEST.RESPONSE.redirect("%s" % context.absolute_url())
41elif disable:
42    context.portal_catalog.setBypassQueue(0)
43    logger.info('%s disabled QueueCatalog Bypass' % (member))
44    psm = "QueueCatalog Bypass disabled!"
45elif psm == 'invalid':
46    return context.import_form(rendered = res,
47                               psm = "Please correct your input!",
48                               ds = ds,
49                              )
50elif psm == '':
51    return context.import_form(rendered = res,
52                               psm = None,
53                               ds = ds,
54                              )
55elif psm == 'valid':
56    psm = context.waeup_tool.importData(ds.get('filename'),
57                                    ds.get('name'),
58                                    ds.get('import_or_edit')
59                                   )
60return context.import_form(rendered = res,
61                                 psm = psm,
62                                 ds = ds,
63                                 )
Note: See TracBrowser for help on using the repository browser.