1 | ##parameters=REQUEST |
---|
2 | # $Id: import.py 2262 2007-09-20 14:02:45Z henrik $ |
---|
3 | """ |
---|
4 | process the Application Form |
---|
5 | return html renderer + psm |
---|
6 | """ |
---|
7 | try: |
---|
8 | from Products.zdb import set_trace |
---|
9 | except: |
---|
10 | def set_trace(): |
---|
11 | pass |
---|
12 | import DateTime |
---|
13 | from urllib import urlencode |
---|
14 | current = DateTime.DateTime() |
---|
15 | pr = context.portal_registration |
---|
16 | |
---|
17 | validate = REQUEST.has_key("import") |
---|
18 | enable = REQUEST.has_key("enable_bypass") |
---|
19 | disable = REQUEST.has_key("disable_bypass") |
---|
20 | #set_trace() |
---|
21 | lt = context.portal_layouts |
---|
22 | #pr = context.portal_registration |
---|
23 | |
---|
24 | res,psm,ds = lt.renderLayout(layout_id= 'import', |
---|
25 | schema_id= 'import', |
---|
26 | context=context, |
---|
27 | mapping=validate and REQUEST, |
---|
28 | ob={}, |
---|
29 | layout_mode='create', |
---|
30 | commit=False, |
---|
31 | ) |
---|
32 | if enable: |
---|
33 | context.portal_catalog.setBypassQueue(1) |
---|
34 | psm = "QueueCatalog Bypass enabled!" |
---|
35 | #return REQUEST.RESPONSE.redirect("%s" % context.absolute_url()) |
---|
36 | elif disable: |
---|
37 | context.portal_catalog.setBypassQueue(0) |
---|
38 | psm = "QueueCatalog Bypass disabled!" |
---|
39 | elif psm == 'invalid': |
---|
40 | return context.import_form(rendered = res, |
---|
41 | psm = "Please correct your input!", |
---|
42 | ds = ds, |
---|
43 | ) |
---|
44 | elif psm == '': |
---|
45 | return context.import_form(rendered = res, |
---|
46 | psm = None, |
---|
47 | ds = ds, |
---|
48 | ) |
---|
49 | elif psm == 'valid': |
---|
50 | psm = context.waeup_tool.importData(ds.get('filename'), |
---|
51 | ds.get('name'), |
---|
52 | ds.get('import_or_edit') |
---|
53 | ) |
---|
54 | return context.import_form(rendered = res, |
---|
55 | psm = psm, |
---|
56 | ds = ds, |
---|
57 | ) |
---|