Changeset 3283 for WAeUP_SRP/base/skins/waeup_upload/uploads_index.py
- Timestamp:
- 7 Mar 2008, 16:37:05 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_upload/uploads_index.py
r3277 r3283 25 25 26 26 path_info = request.get('PATH_INFO').split('/') 27 27 NO_KEY = '----' 28 28 info = {} 29 29 info['action'] = "%s" % context.absolute_url() … … 36 36 #set_trace() 37 37 if edit and ids: 38 for id in ids: 39 doc = getattr(context, "%s.csv" % id).getContent() 40 doc.edit(mapping = request.form[id]) 38 for long_id in ids: 39 short_id = long_id.replace('.csv','') 40 doc = getattr(context, long_id).getContent() 41 doc.edit(mapping = request.form[short_id]) 41 42 msg, invalid_keys = doc['checkKeys']() 42 43 new_keys = [] 43 44 for key in invalid_keys: 44 id_key = "%s|%s" % ( id,key)45 id_key = "%s|%s" % (short_id,key) 45 46 if request.form.has_key(id_key): 46 new_keys += (key,request.form.get(id_key)['valid_key']), 47 new_key = request.form.get(id_key)['valid_key'] 48 if new_key != NO_KEY: 49 new_keys += (key,new_key), 47 50 if new_keys: 48 51 doc.editHeadline(new_keys) … … 53 56 doc = upload.getContent() 54 57 row['valid_keys'] = doc['getKeys']() 58 row['valid_keys'][0] = NO_KEY 55 59 row['id'] = id.replace('.csv','') 56 60 row['title'] = doc.filename … … 75 79 commit = True, 76 80 ) 77 if psm == 'invalid': 78 return context.uploads_form(rendered = res, 79 psm = "Please correct your input!", 80 mode = mode, 81 ds = ds, 82 info = info, 83 ) 84 elif psm == '': 81 while True: 82 if psm == 'invalid': 83 psm = "Please correct your input!" 84 # return context.uploads_form(rendered = res, 85 # psm = "Please correct your input!", 86 # mode = mode, 87 # ds = ds, 88 # info = info, 89 # ) 90 elif psm == 'valid': 91 filename = ds['upload_file'].filename 92 if filename not in context.objectIds(): 93 break 94 psm = "Upload file exists" 85 95 return context.uploads_form(rendered = res, 86 96 psm = psm, … … 89 99 info = info, 90 100 ) 91 elif psm == 'valid':92 pass93 filename = ds['upload_file'].filename94 101 95 if filename not in context.objectIds(): 96 context.invokeFactory('Upload',filename) 97 upload = getattr(context,filename) 98 d = {} 99 d['filename'] = d['id'] = filename 100 d['upload_date'] = DateTime.DateTime() 101 d['import_layout'] = ds.get('import_layout','') 102 d['uploaded_by'] = str(member) 103 d['url'] = upload.absolute_url() 104 upload.getContent().edit(mapping=d) 105 #info['items'].append(d) 102 context.invokeFactory('Upload',filename) 103 upload = getattr(context,filename) 104 d = {} 105 d['filename'] = d['id'] = filename 106 d['upload_date'] = DateTime.DateTime() 107 d['import_layout'] = ds.get('import_layout','') 108 d['uploaded_by'] = str(member) 109 d['url'] = upload.absolute_url() 110 upload.getContent().edit(mapping=d) 111 106 112 request.RESPONSE.redirect(context.absolute_url()) 107 113
Note: See TracChangeset for help on using the changeset viewer.