[1756] | 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 | """ |
---|
[2259] | 7 | try: |
---|
| 8 | from Products.zdb import set_trace |
---|
| 9 | except: |
---|
| 10 | def set_trace(): |
---|
| 11 | pass |
---|
[1756] | 12 | import DateTime |
---|
| 13 | from urllib import urlencode |
---|
| 14 | current = DateTime.DateTime() |
---|
| 15 | pr = context.portal_registration |
---|
| 16 | |
---|
| 17 | validate = REQUEST.has_key("import") |
---|
[2259] | 18 | enable = REQUEST.has_key("enable_bypass") |
---|
| 19 | disable = REQUEST.has_key("disable_bypass") |
---|
| 20 | #set_trace() |
---|
[1756] | 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 | ) |
---|
[2259] | 32 | if enable: |
---|
| 33 | context.portal_catalog.setBypassQueue(1) |
---|
[2262] | 34 | psm = "QueueCatalog Bypass enabled!" |
---|
| 35 | #return REQUEST.RESPONSE.redirect("%s" % context.absolute_url()) |
---|
[2259] | 36 | elif disable: |
---|
| 37 | context.portal_catalog.setBypassQueue(0) |
---|
[2262] | 38 | psm = "QueueCatalog Bypass disabled!" |
---|
[2259] | 39 | elif psm == 'invalid': |
---|
[1756] | 40 | return context.import_form(rendered = res, |
---|
[1774] | 41 | psm = "Please correct your input!", |
---|
| 42 | ds = ds, |
---|
| 43 | ) |
---|
[1756] | 44 | elif psm == '': |
---|
| 45 | return context.import_form(rendered = res, |
---|
[1774] | 46 | psm = None, |
---|
| 47 | ds = ds, |
---|
| 48 | ) |
---|
[1756] | 49 | elif psm == 'valid': |
---|
[2259] | 50 | psm = context.waeup_tool.importData(ds.get('filename'), |
---|
[1774] | 51 | ds.get('name'), |
---|
| 52 | ds.get('import_or_edit') |
---|
| 53 | ) |
---|
[1756] | 54 | return context.import_form(rendered = res, |
---|
| 55 | psm = psm, |
---|
| 56 | ds = ds, |
---|
| 57 | ) |
---|